Author: metze Date: 2007-08-22 11:55:48 +0000 (Wed, 22 Aug 2007) New Revision: 24618
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24618 Log: move printing out the version string and exit() into the popt _POST processing. Now 'smbd -V --bla' complains about an unknown option metze Modified: branches/SAMBA_3_2/source/lib/popt_common.c Changeset: Modified: branches/SAMBA_3_2/source/lib/popt_common.c =================================================================== --- branches/SAMBA_3_2/source/lib/popt_common.c 2007-08-22 11:23:24 UTC (rev 24617) +++ branches/SAMBA_3_2/source/lib/popt_common.c 2007-08-22 11:55:48 UTC (rev 24618) @@ -57,6 +57,8 @@ 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 @@ 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 @@ 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_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" },