mirror of
https://github.com/samba-team/samba.git
synced 2025-08-02 00:22:11 +03:00
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 c115de4bea
)
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
aa1c863063
commit
faab8dba02
@ -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" },
|
||||
|
Reference in New Issue
Block a user