svn commit: samba r24620 - in branches/SAMBA_4_0/source/lib/cmdline: .

metze at samba.org metze at samba.org
Wed Aug 22 12:04:42 GMT 2007


Author: metze
Date: 2007-08-22 12:04:42 +0000 (Wed, 22 Aug 2007)
New Revision: 24620

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24620

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_4_0/source/lib/cmdline/popt_common.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/cmdline/popt_common.c
===================================================================
--- branches/SAMBA_4_0/source/lib/cmdline/popt_common.c	2007-08-22 12:03:13 UTC (rev 24619)
+++ branches/SAMBA_4_0/source/lib/cmdline/popt_common.c	2007-08-22 12:04:42 UTC (rev 24620)
@@ -39,6 +39,8 @@
 
 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 @@
 	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 @@
 		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_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 }
 };



More information about the samba-cvs mailing list