Mercurial > hg > toybox
changeset 773:edde4d30e98c
Ashwini Sharma pointed out that my previous tweak to [!abc] groups still didn't get the error reporting right (test case "touch -d 12 -r f2 f1"). This says "no 'r' with 'd'" for that, and still shouldn't be able to fall off the end of the list (segfault) because an option can't conflict with itself (that's what the ~(1<<i) on lib/args.c line 317 is for).
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 29 Dec 2012 03:18:34 -0600 |
parents | dbf0480c88f4 |
children | adab8adf5f6d |
files | lib/args.c |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/args.c Thu Dec 27 17:55:21 2012 +0100 +++ b/lib/args.c Sat Dec 29 03:18:34 2012 -0600 @@ -132,8 +132,10 @@ struct opts *bad; unsigned i = 1; - for (bad=gof->opts; opt == bad || !(gof->excludes & i); bad = bad->next) - i<<=1; + for (bad=gof->opts, i=1; ;bad = bad->next, i<<=1) { + if (opt == bad || !(i & toys.optflags)) continue; + if (toys.optflags & bad->dex[2]) break; + } error_exit("No '%c' with '%c'", opt->c, bad->c); }