summaryrefslogtreecommitdiffhomepage
path: root/src/driver/slbt_driver_ctx.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-05-13 07:33:32 +0000
committermidipix <writeonce@midipix.org>2021-05-13 07:36:22 +0000
commit18c9fcfbabb52c43c6b8bd7753647587c2add578 (patch)
tree964e44abc3b980de0e9a7795f462a16b7e77001e /src/driver/slbt_driver_ctx.c
parent5b1d0eb3aedc298d93a660992e06aed50bc3fd7b (diff)
downloadslibtool-18c9fcfbabb52c43c6b8bd7753647587c2add578.tar.bz2
slibtool-18c9fcfbabb52c43c6b8bd7753647587c2add578.tar.xz
driver: handle --version as only (repeated) argument more elegantly.
Diffstat (limited to 'src/driver/slbt_driver_ctx.c')
-rw-r--r--src/driver/slbt_driver_ctx.c13
1 files changed, 8 insertions, 5 deletions
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];