From 7c05d6a179caa5139a48da68b350502685c60639 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 12 Apr 2016 04:32:09 -0400 Subject: utility: properly handle --version when it is the only passed argument. --- src/slibtool.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') 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] = ""; + 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; -- cgit v1.2.3