diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-08-22 11:55:48 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:30:11 -0500 |
commit | faab8dba02d364dccf341e0f6756b1bf625d3c5b (patch) | |
tree | 735790b4820c4b4bdcf136069f8b596ced94f3f1 /source3 | |
parent | aa1c863063619524361d0e4003149edd2c3fa3a8 (diff) | |
download | samba-faab8dba02d364dccf341e0f6756b1bf625d3c5b.tar.gz samba-faab8dba02d364dccf341e0f6756b1bf625d3c5b.tar.bz2 samba-faab8dba02d364dccf341e0f6756b1bf625d3c5b.zip |
r24618: 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 c115de4beac887442a73b4a85367d7b5fded68e6)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/popt_common.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c index efffd3c11b..3be25b4363 100644 --- a/source3/lib/popt_common.c +++ b/source3/lib/popt_common.c @@ -57,6 +57,8 @@ static void set_logfile(poptContext con, const char * arg) lp_set_logfile(logfile); } +static BOOL PrintSambaVersionString; + static void popt_common_callback(poptContext con, enum poptCallbackReason reason, const struct poptOption *opt, @@ -68,6 +70,14 @@ static void popt_common_callback(poptContext con, return; } + if (reason == POPT_CALLBACK_REASON_POST) { + if (!PrintSambaVersionString) return; + + printf( "Version %s\n", SAMBA_VERSION_STRING); + exit(0); + return; + } + switch(opt->val) { case 'd': if (arg) { @@ -77,8 +87,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': @@ -133,7 +142,7 @@ struct poptOption popt_common_connection[] = { }; struct poptOption popt_common_samba[] = { - { NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE, (void *)popt_common_callback }, + { NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE|POPT_CBFLAG_POST, (void *)popt_common_callback }, { "debuglevel", 'd', POPT_ARG_STRING, NULL, 'd', "Set debug level", "DEBUGLEVEL" }, { "configfile", 's', POPT_ARG_STRING, NULL, 's', "Use alternate configuration file", "CONFIGFILE" }, { "log-basename", 'l', POPT_ARG_STRING, NULL, 'l', "Base name for log files", "LOGFILEBASE" }, |