summaryrefslogtreecommitdiffhomepage
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-08-09 05:41:38 -0400
committermidipix <writeonce@midipix.org>2018-08-09 05:41:38 -0400
commit633f4efee8aabdaa7e3827cfe1af15e4c7842bdc (patch)
tree965f41cfbf67d2e187a71266ea01007a400275c0 /src/driver
parentbc7f340339fe16f55cddded948123c5c41a3bb3d (diff)
downloadslibtool-633f4efee8aabdaa7e3827cfe1af15e4c7842bdc.tar.bz2
slibtool-633f4efee8aabdaa7e3827cfe1af15e4c7842bdc.tar.xz
front-end utility: slbt_main(): remove the redundant argc parameter.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/slbt_amain.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/driver/slbt_amain.c b/src/driver/slbt_amain.c
index a331b3b..e0d6bb9 100644
--- a/src/driver/slbt_amain.c
+++ b/src/driver/slbt_amain.c
@@ -83,10 +83,10 @@ static int slbt_exit(struct slbt_driver_ctx * dctx, int ret)
return ret;
}
-int slbt_main(int argc, char ** argv, char ** envp,
- const struct slbt_fd_ctx * fdctx)
+int slbt_main(char ** argv, char ** envp, const struct slbt_fd_ctx * fdctx)
{
int ret;
+ const char * harg;
int fdout;
uint64_t flags;
struct slbt_driver_ctx * dctx;
@@ -97,11 +97,15 @@ int slbt_main(int argc, char ** argv, char ** envp,
flags = SLBT_DRIVER_FLAGS;
fdout = fdctx ? fdctx->fdout : STDOUT_FILENO;
+ /* harg */
+ harg = (!argv || !argv[0] || !argv[1] || argv[2])
+ ? 0 : argv[1];
+
/* --version only? */
- if ((argc == 2) && (!strcmp(argv[1],"--version")
- || !strcmp(argv[1],"--help-all")
- || !strcmp(argv[1],"--help")
- || !strcmp(argv[1],"-h"))) {
+ 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";
@@ -153,7 +157,7 @@ int slbt_main(int argc, char ** argv, char ** envp,
/* driver context */
if ((ret = slbt_get_driver_ctx(argv,envp,flags,fdctx,&dctx)))
return (ret == SLBT_USAGE)
- ? !--argc
+ ? !argv || !argv[0] || !argv[1]
: SLBT_ERROR;
if (dctx->cctx->drvflags & SLBT_DRIVER_VERSION)