summaryrefslogtreecommitdiff
path: root/src
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
parentbc7f340339fe16f55cddded948123c5c41a3bb3d (diff)
downloadslibtool-633f4efee8aabdaa7e3827cfe1af15e4c7842bdc.tar.bz2
slibtool-633f4efee8aabdaa7e3827cfe1af15e4c7842bdc.tar.xz
front-end utility: slbt_main(): remove the redundant argc parameter.
Diffstat (limited to 'src')
-rw-r--r--src/driver/slbt_amain.c18
-rw-r--r--src/slibtool.c2
2 files changed, 12 insertions, 8 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)
diff --git a/src/slibtool.c b/src/slibtool.c
index a21c9f1..130474e 100644
--- a/src/slibtool.c
+++ b/src/slibtool.c
@@ -8,5 +8,5 @@
int main(int argc, char ** argv, char ** envp)
{
- return slbt_main(argc,argv,envp,0);
+ return slbt_main(argv,envp,0);
}