[Pkg-shadow-commits] r1537 - in upstream/trunk: . src

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Fri Dec 28 21:04:04 UTC 2007


Author: nekral-guest
Date: 2007-12-28 21:04:04 +0000 (Fri, 28 Dec 2007)
New Revision: 1537

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/groupadd.c
Log:
New function check_flags(). Split the validation of
options and arguments out of process_flags.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2007-12-28 20:46:24 UTC (rev 1536)
+++ upstream/trunk/ChangeLog	2007-12-28 21:04:04 UTC (rev 1537)
@@ -22,6 +22,8 @@
 	* src/groupadd.c: Avoid implicit brackets.
 	* src/groupadd.c: Split the processing and checking of options out of
 	main() (process_flags).
+	* src/groupadd.c: New function check_flags(). Split the validation of
+	options and arguments out of process_flags.
 	* src/groupadd.c: Add the parameters' names in the prototypes.
 
 2007-12-27  Nicolas François  <nicolas.francois at centraliens.net>

Modified: upstream/trunk/src/groupadd.c
===================================================================
--- upstream/trunk/src/groupadd.c	2007-12-28 20:46:24 UTC (rev 1536)
+++ upstream/trunk/src/groupadd.c	2007-12-28 21:04:04 UTC (rev 1537)
@@ -91,6 +91,7 @@
 static void fail_exit (int code);
 static gid_t get_gid (const char *gidstr);
 static void process_flags (int argc, char **argv);
+static void check_flags (void);
 static void check_perms (void);
 
 /*
@@ -434,16 +435,21 @@
 	/*
 	 * Check the flags consistency
 	 */
-	if (oflg && !gflg) {
+	if (optind != argc - 1) {
 		usage ();
 	}
+	group_name = argv[optind];
 
-	if (optind != argc - 1) {
+	check_flags ();
+}
+
+static void check_flags (void)
+{
+	/* -o does not make sense without -g */
+	if (oflg && !gflg) {
 		usage ();
 	}
 
-	group_name = argv[optind];
-
 	check_new_name ();
 
 	/*




More information about the Pkg-shadow-commits mailing list