diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-08-22 12:04:42 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:02:25 -0500 |
commit | 35b16479a59510a35fc38ff7c0e8ad91c2def141 (patch) | |
tree | 26b6c28123207f7f41ebade69a09615277197fb4 /source4/lib | |
parent | b39330c4873d4c3923a577e89690fc0e43b0c61a (diff) | |
download | samba-35b16479a59510a35fc38ff7c0e8ad91c2def141.tar.gz samba-35b16479a59510a35fc38ff7c0e8ad91c2def141.tar.bz2 samba-35b16479a59510a35fc38ff7c0e8ad91c2def141.zip |
r24620: move printing out the version string and exit()
into the popt _POST processing.
Now 'smbd -V --bla' complains about an unknown option
metze
(This used to be commit 69bf7f1874c8e89b61c4baa03ff9ad191e71b804)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/cmdline/popt_common.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c index 904a873892..413c8e7cc3 100644 --- a/source4/lib/cmdline/popt_common.c +++ b/source4/lib/cmdline/popt_common.c @@ -39,6 +39,8 @@ enum {OPT_OPTION=1,OPT_LEAK_REPORT,OPT_LEAK_REPORT_FULL,OPT_DEBUG_STDERR}; struct cli_credentials *cmdline_credentials = NULL; +static bool PrintSambaVersionString; + static void popt_common_callback(poptContext con, enum poptCallbackReason reason, const struct poptOption *opt, @@ -47,6 +49,11 @@ static void popt_common_callback(poptContext con, const char *pname; if (reason == POPT_CALLBACK_REASON_POST) { + if (PrintSambaVersionString) { + printf( "Version %s\n", SAMBA_VERSION_STRING ); + exit(0); + } + lp_load(); /* Hook any 'every Samba program must do this, after * the smb.conf is setup' functions here */ @@ -85,8 +92,7 @@ static void popt_common_callback(poptContext con, break; case 'V': - printf( "Version %s\n", SAMBA_VERSION_STRING ); - exit(0); + PrintSambaVersionString = true; break; case 'O': @@ -176,7 +182,7 @@ struct poptOption popt_common_samba[] = { }; struct poptOption popt_common_version[] = { - { NULL, 0, POPT_ARG_CALLBACK, (void *)popt_common_callback }, + { NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_POST, (void *)popt_common_callback }, { "version", 'V', POPT_ARG_NONE, NULL, 'V', "Print version" }, { NULL } }; |