diff options
author | midipix <writeonce@midipix.org> | 2024-02-16 04:07:22 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2024-02-16 05:56:07 +0000 |
commit | 5c8c001fb81b54dda6126bcc7f3b076070a75fbe (patch) | |
tree | 9cfd64c999794e8e3289a8926cf96af91e0546ff /src | |
parent | 5ddd2aa439b1ce23b4322cf0abd89a49a8533606 (diff) | |
download | slibtool-5c8c001fb81b54dda6126bcc7f3b076070a75fbe.tar.bz2 slibtool-5c8c001fb81b54dda6126bcc7f3b076070a75fbe.tar.xz |
slbt_get_exec_ctx(): add tool-specific arguments to the total argument count.
Diffstat (limited to 'src')
-rw-r--r-- | src/logic/slbt_exec_ctx.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c index 039ba14..8c718ae 100644 --- a/src/logic/slbt_exec_ctx.c +++ b/src/logic/slbt_exec_ctx.c @@ -48,9 +48,24 @@ static char * slbt_source_file(char ** argv) } +static int slbt_exec_ctx_tool_argc(char ** argv) +{ + char ** parg; + + if (!(parg = argv)) + return 0; + + for (; *parg; ) + parg++; + + return parg - argv + 1; +} + + static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc( const struct slbt_driver_ctx * dctx) { + struct slbt_driver_ctx_impl * ctx; struct slbt_exec_ctx_impl * ictx; size_t size; size_t vsize; @@ -63,6 +78,17 @@ static struct slbt_exec_ctx_impl * slbt_exec_ctx_alloc( argc = 0; csrc = 0; + /* internal driver context for host-specific tool arguments */ + ctx = slbt_get_driver_ictx(dctx); + + /* tool-specific argv: to simplify matters, be additive */ + argc += slbt_exec_ctx_tool_argc(ctx->host.ar_argv); + argc += slbt_exec_ctx_tool_argc(ctx->host.as_argv); + argc += slbt_exec_ctx_tool_argc(ctx->host.ranlib_argv); + argc += slbt_exec_ctx_tool_argc(ctx->host.windres_argv); + argc += slbt_exec_ctx_tool_argc(ctx->host.dlltool_argv); + argc += slbt_exec_ctx_tool_argc(ctx->host.mdso_argv); + /* clerical [worst-case] buffer size (guard, .libs, version) */ size = strlen(".lo") + 1; size += 12 * (strlen(".libs/") + 1); |