aboutsummaryrefslogtreecommitdiff
path: root/scripts/mkflags.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-07-17 02:14:35 -0500
committerRob Landley <rob@landley.net>2016-07-17 02:14:35 -0500
commit48ea55969907286d1a125fcd655be9d8307a3449 (patch)
tree5c3c063aff438dabce709813abe575cddccb1b54 /scripts/mkflags.c
parenta1ce0934085f7dba3aa64ae1ba2732a2fc323549 (diff)
downloadtoybox-48ea55969907286d1a125fcd655be9d8307a3449.tar.gz
The recent option parsing changes broke the multiplexer, because the "toybox"
command was trying to parse their options and failing. (Commands that aren't just disabled but have no option string even in the allyesconfig case need an OPTSTR of 0.) This is probably only a partial fix, there's some design work to think through here.
Diffstat (limited to 'scripts/mkflags.c')
-rw-r--r--scripts/mkflags.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/mkflags.c b/scripts/mkflags.c
index 27fc5172..39b935bb 100644
--- a/scripts/mkflags.c
+++ b/scripts/mkflags.c
@@ -122,7 +122,7 @@ int main(int argc, char *argv[])
for (;;) {
struct flag *flist, *aflist, *offlist;
- char *mgaps;
+ char *mgaps = 0;
unsigned bit;
*command = *flags = *allflags = 0;
@@ -141,11 +141,13 @@ int main(int argc, char *argv[])
bit = 0;
printf("// %s %s %s\n", command, flags, allflags);
- mgaps = mark_gaps(flags, allflags);
+ if (*flags != ' ') mgaps = mark_gaps(flags, allflags);
+ else if (*allflags != ' ') mgaps = allflags;
// If command disabled, use allflags for OLDTOY()
- printf("#undef OPTSTR_%s\n#define OPTSTR_%s \"%s\"\n",
- command, command, strcmp(flags, " ") ? mgaps : allflags);
- free(mgaps);
+ printf("#undef OPTSTR_%s\n#define OPTSTR_%s ", command, command);
+ if (mgaps) printf("\"%s\"\n", mgaps);
+ else printf("0\n");
+ if (mgaps != allflags) free(mgaps);
flist = digest(flags);
offlist = aflist = digest(allflags);