diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/driver/slbt_amain.c | 23 | ||||
-rw-r--r-- | src/driver/slbt_driver_ctx.c | 13 |
2 files changed, 8 insertions, 28 deletions
diff --git a/src/driver/slbt_amain.c b/src/driver/slbt_amain.c index 78a0973..d364ef4 100644 --- a/src/driver/slbt_amain.c +++ b/src/driver/slbt_amain.c @@ -91,40 +91,17 @@ static int slbt_exit(struct slbt_driver_ctx * dctx, int ret) int slbt_main(char ** argv, char ** envp, const struct slbt_fd_ctx * fdctx) { int ret; - const char * harg; int fdout; uint64_t flags; uint64_t noclr; struct slbt_driver_ctx * dctx; char * program; char * dash; - char * sargv[5]; flags = SLBT_DRIVER_FLAGS; fdout = fdctx ? fdctx->fdout : STDOUT_FILENO; noclr = getenv("NO_COLOR") ? SLBT_DRIVER_ANNOTATE_NEVER : 0; - /* harg */ - harg = (!argv || !argv[0] || !argv[1] || argv[2]) - ? 0 : argv[1]; - - /* --version only? */ - if (harg && (!strcmp(harg,"--version") - || !strcmp(harg,"--help-all") - || !strcmp(harg,"--help") - || !strcmp(harg,"-h"))) { - sargv[0] = argv[0]; - sargv[1] = argv[1]; - sargv[2] = "--mode=compile"; - sargv[3] = "<compiler>"; - sargv[4] = 0; - - return (slbt_get_driver_ctx(sargv,envp,flags|noclr,fdctx,&dctx)) - ? SLBT_ERROR : (slbt_version(dctx,fdout) < 0) - ? slbt_exit(dctx,SLBT_ERROR) - : slbt_exit(dctx,SLBT_OK); - } - /* program */ if ((program = strrchr(argv[0],'/'))) program++; diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index 68cb136..fe7a9ed 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -290,6 +290,7 @@ static int slbt_split_argv( struct argv_entry * entry; struct argv_entry * mode; struct argv_entry * help; + struct argv_entry * version; struct argv_entry * config; struct argv_entry * finish; struct argv_entry * features; @@ -336,14 +337,16 @@ static int slbt_split_argv( meta = argv_get(argv,optv,ARGV_VERBOSITY_NONE,fderr); } - /* missing all of --mode, --help, --config, --features, and --finish? */ - mode = help = config = finish = features = ccwrap = 0; + /* missing all of --mode, --help, --version, --config, --features, and --finish? */ + mode = help = version = config = finish = features = ccwrap = 0; for (entry=meta->entries; entry->fopt; entry++) if (entry->tag == TAG_MODE) mode = entry; else if (entry->tag == TAG_HELP) help = entry; + else if (entry->tag == TAG_VERSION) + version = entry; else if (entry->tag == TAG_CONFIG) config = entry; else if (entry->tag == TAG_FINISH) @@ -355,7 +358,7 @@ static int slbt_split_argv( argv_free(meta); - if (!mode && !help && !config && !finish && !features) { + if (!mode && !help && !version && !config && !finish && !features) { slbt_dprintf(fderr, "%s: error: --mode must be specified.\n", program); @@ -363,7 +366,7 @@ static int slbt_split_argv( } /* missing compiler? */ - if (!ctx.unitidx && !help && !finish && !features) { + if (!ctx.unitidx && !help && !version && !finish && !features) { if (flags & SLBT_DRIVER_VERBOSITY_ERRORS) slbt_dprintf(fderr, "%s: error: <compiler> is missing.\n", @@ -488,7 +491,7 @@ static int slbt_split_argv( if (ctx.unitidx) { (void)0; - } else if (help || features) { + } else if (help || version || features) { for (i=0; i<argc; i++) sargv->targv[i] = argv[i]; |