summaryrefslogtreecommitdiff
path: root/src/driver/slbt_split_argv.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2025-06-18 06:08:22 +0000
committermidipix <writeonce@midipix.org>2025-06-18 06:08:22 +0000
commit1ebed354a9dd1f390483abc21c69bbe2fc698fc8 (patch)
tree6f91880205a43b9eff065787a75c107ebca0c14b /src/driver/slbt_split_argv.c
parent8567306be556c14b2b99098f9510f50d3322a842 (diff)
downloadslibtool-1ebed354a9dd1f390483abc21c69bbe2fc698fc8.tar.bz2
slibtool-1ebed354a9dd1f390483abc21c69bbe2fc698fc8.tar.xz
driver: slbt_split_argv(): special-case argv[0], properly handle --mode=execute.
Diffstat (limited to 'src/driver/slbt_split_argv.c')
-rw-r--r--src/driver/slbt_split_argv.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/driver/slbt_split_argv.c b/src/driver/slbt_split_argv.c
index acf8da9..3e18bdf 100644
--- a/src/driver/slbt_split_argv.c
+++ b/src/driver/slbt_split_argv.c
@@ -46,6 +46,7 @@ slbt_hidden int slbt_split_argv(
bool flast;
bool fcopy;
bool altmode;
+ bool execmode;
size_t size;
const char * base;
struct argv_meta * meta;
@@ -129,6 +130,9 @@ slbt_hidden int slbt_split_argv(
/* as well as -print-aux-dir and -print-m4-dir? */
mode = help = version = info = config = finish = features = ccwrap = dumpmachine = printdir = printext = aropt = stoolieopt = 0;
+ /* --mode=execute implies -- right after the executable path argument */
+ execmode = false;
+
for (entry=meta->entries; entry->fopt; entry++)
if (entry->tag == TAG_MODE)
mode = entry;
@@ -167,6 +171,9 @@ slbt_hidden int slbt_split_argv(
if (!altmode && mode && !strcmp(mode->arg,"slibtoolize"))
stoolieopt = mode;
+ if (mode && !strcmp(mode->arg,"execute"))
+ execmode = true;
+
/* release temporary argv meta context */
slbt_argv_free(meta);
@@ -222,6 +229,9 @@ slbt_hidden int slbt_split_argv(
if ((fcopy = (flast || altmode || aropt || stoolieopt))) {
(void)0;
+ } else if (i == 0) {
+ fcopy = true;
+
} else if (!strcmp(argv[i],"--")) {
flast = true;
fcopy = true;
@@ -319,6 +329,9 @@ slbt_hidden int slbt_split_argv(
} else {
fcopy = true;
+
+ if (execmode)
+ flast = true;
}
if (fcopy) {