diff options
author | Rob Landley <rob@landley.net> | 2016-06-30 20:41:07 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-06-30 20:41:07 -0500 |
commit | ec0b482e9fd27cb994b30e0f1b8a4d39a85735cc (patch) | |
tree | 8bcc18d50c30c59d2d4f1cf35c4e3fc6035ded05 | |
parent | 20f67f157c2284057328e6391d10e329b088f8d2 (diff) | |
download | toybox-ec0b482e9fd27cb994b30e0f1b8a4d39a85735cc.tar.gz |
Fix option parsing infrastructure bug.
In main.c: used adjusted string with placeholers for removed options (so flag
values don't move based on config, allowing FORCE_FLAGS to work).
In scripts/mkflags.c: test was wrong, a bare longopt never matches a single
letter command, but it was treated as always matching when comparing
allyesconfig vs current config to determine which options were disabled, so
there was a corner case that got the flag values wrong.
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | scripts/mkflags.c | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -13,7 +13,7 @@ #undef NEWTOY #undef OLDTOY -#define NEWTOY(name, opts, flags) {#name, name##_main, opts, flags}, +#define NEWTOY(name, opts, flags) {#name, name##_main, OPTSTR_##name, flags}, #define OLDTOY(name, oldname, flags) \ {#name, oldname##_main, OPTSTR_##oldname, flags}, diff --git a/scripts/mkflags.c b/scripts/mkflags.c index da3b2f9b..8b3d0aa3 100644 --- a/scripts/mkflags.c +++ b/scripts/mkflags.c @@ -194,7 +194,7 @@ int main(int argc, char *argv[]) } // Output normal flag macro } else if (aflist->command) { - if (flist && (!flist->command || *aflist->command == *flist->command)) { + if (flist && flist->command && *aflist->command == *flist->command) { if (aflist->command) sprintf(out, "#define FLAG_%c (1%s<<%d)\n", *aflist->command, llstr, bit); |