From 6d91e0fcaa4e80eac6053ea14944537d7a6a057b Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 27 Dec 2012 18:44:37 -0600 Subject: Fix option grouping. --- lib/args.c | 5 +++-- 1 file 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 +-!"); -- cgit v1.2.3