diff options
author | Rob Landley <rob@landley.net> | 2014-02-16 17:31:33 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-02-16 17:31:33 -0600 |
commit | a2359011a808463b86b3b7477a7c0d06f8445df6 (patch) | |
tree | ad18d3e06e163bc7e18df4dab79d5974c5486812 /scripts/mkflags.c | |
parent | 1fb3ae7075ab9d198b757f7da5cc9c748abc3574 (diff) | |
download | toybox-a2359011a808463b86b3b7477a7c0d06f8445df6.tar.gz |
Make CLEANUP transitions work, so multiple NEWTOY() can exist in the same file.
Don't #undefine TT in the CLEANUP blocks of generated/flags.h, and #ifdef
around the other TT definition. That way you can put a union at the start
of your GLOBALS() with the arguments filled out by option parsing, and then
have multiple main() functions with different argumetns and different
FLAG_x macros, while sharing infrastructure that's not under lib.
Diffstat (limited to 'scripts/mkflags.c')
-rw-r--r-- | scripts/mkflags.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/mkflags.c b/scripts/mkflags.c index c350b198..a8e5216e 100644 --- a/scripts/mkflags.c +++ b/scripts/mkflags.c @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) offlist = aflist = digest(allflags); - printf("#ifdef CLEANUP_%s\n#undef CLEANUP_%s\n#undef FOR_%s\n#undef TT\n", + printf("#ifdef CLEANUP_%s\n#undef CLEANUP_%s\n#undef FOR_%s\n", command, command, command); while (offlist) { @@ -99,7 +99,8 @@ int main(int argc, char *argv[]) } printf("#endif\n\n"); - printf("#ifdef FOR_%s\n#define TT this.%s\n", command, command); + printf("#ifdef FOR_%s\n#ifndef TT\n#define TT this.%s\n#endif\n", + command, command); while (aflist) { if (aflist->lopt) { |