diff options
author | midipix <writeonce@midipix.org> | 2021-05-13 07:33:32 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2021-05-13 07:36:22 +0000 |
commit | 18c9fcfbabb52c43c6b8bd7753647587c2add578 (patch) | |
tree | 964e44abc3b980de0e9a7795f462a16b7e77001e /src/driver/slbt_amain.c | |
parent | 5b1d0eb3aedc298d93a660992e06aed50bc3fd7b (diff) | |
download | slibtool-18c9fcfbabb52c43c6b8bd7753647587c2add578.tar.bz2 slibtool-18c9fcfbabb52c43c6b8bd7753647587c2add578.tar.xz |
driver: handle --version as only (repeated) argument more elegantly.
Diffstat (limited to 'src/driver/slbt_amain.c')
-rw-r--r-- | src/driver/slbt_amain.c | 23 |
1 files changed, 0 insertions, 23 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++; |