aboutsummaryrefslogtreecommitdiff
path: root/lib/args.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-12-27 18:44:37 -0600
committerRob Landley <rob@landley.net>2012-12-27 18:44:37 -0600
commit6d91e0fcaa4e80eac6053ea14944537d7a6a057b (patch)
tree0ade278b6b379b57868e06346968924d2ba62074 /lib/args.c
parentbf1e70f3554c2f591e15df7abca03138861e5c6c (diff)
downloadtoybox-6d91e0fcaa4e80eac6053ea14944537d7a6a057b.tar.gz
Fix option grouping.
Diffstat (limited to 'lib/args.c')
-rw-r--r--lib/args.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/args.c b/lib/args.c
index 7033772e..e4b774b4 100644
--- a/lib/args.c
+++ b/lib/args.c
@@ -132,7 +132,8 @@ static int gotflag(struct getoptflagstate *gof, struct opts *opt)
struct opts *bad;
unsigned i = 1;
- for (bad=gof->opts; gof->excludes && i; bad = bad->next) i<<=1;
+ for (bad=gof->opts; opt == bad || !(gof->excludes & i); bad = bad->next)
+ i<<=1;
error_exit("No '%c' with '%c'", opt->c, bad->c);
}
@@ -292,7 +293,7 @@ void parse_optflaglist(struct getoptflagstate *gof)
while (*options) {
unsigned bits = 0;
- if (CFG_TOYBOX_DEBUG && *options) error_exit("trailing %s", options);
+ if (CFG_TOYBOX_DEBUG && *options != '[') error_exit("trailing %s", options);
idx = stridx("-|!+", *++options);
if (CFG_TOYBOX_DEBUG && idx == -1) error_exit("[ needs +-!");