summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-12 04:32:09 -0400
committermidipix <writeonce@midipix.org>2016-04-12 04:32:09 -0400
commit7c05d6a179caa5139a48da68b350502685c60639 (patch)
treeb21165860525999498a210625d28f84f1275dd28
parentf9dfdb09508d4b576245c6a41a216507af91ab49 (diff)
downloadslibtool-7c05d6a179caa5139a48da68b350502685c60639.tar.bz2
slibtool-7c05d6a179caa5139a48da68b350502685c60639.tar.xz
utility: properly handle --version when it is the only passed argument.
-rw-r--r--src/slibtool.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/slibtool.c b/src/slibtool.c
index 9ac8ef2..229686d 100644
--- a/src/slibtool.c
+++ b/src/slibtool.c
@@ -53,6 +53,21 @@ int slibtool_main(int argc, char ** argv, char ** envp)
struct slbt_driver_ctx * dctx;
struct slbt_unit_ctx * uctx;
const char ** unit;
+ char * sargv[5];
+
+ /* --version only? */
+ if ((argc == 2) && !strcmp(argv[1],"--version")) {
+ sargv[0] = argv[0];
+ sargv[1] = argv[1];
+ sargv[2] = "--mode=compile";
+ sargv[3] = "<compiler>";
+ sargv[4] = 0;
+
+ return (slbt_get_driver_ctx(sargv,envp,SLBT_DRIVER_FLAGS,&dctx))
+ ? 2 : (slibtool_version(dctx) < 0)
+ ? slibtool_exit(dctx,2)
+ : slibtool_exit(dctx,0);
+ }
if ((ret = slbt_get_driver_ctx(argv,envp,SLBT_DRIVER_FLAGS,&dctx)))
return (ret == SLBT_USAGE) ? !--argc : 2;