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

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Fri Aug 22 02:28:16 UTC 2008


Author: nekral-guest
Date: 2008-08-22 02:28:15 +0000 (Fri, 22 Aug 2008)
New Revision: 2280

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/NEWS
   upstream/trunk/man/gpasswd.1.xml
   upstream/trunk/src/gpasswd.c
Log:
	* NEWS, src/gpasswd.c: Use getopt_long instead of getopt. Added
	support for long options --add (-a), --delete (-d),
	--remove-password (-r), --restrict (-R), --administrators (-A),
	and --members (-M)
	* man/gpasswd.1.xml: Document the new long options.
	* src/gpasswd.c: The sgrp structure is only used if SHADOWGRP is
	defined.

Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-08-22 02:27:26 UTC (rev 2279)
+++ upstream/trunk/ChangeLog	2008-08-22 02:28:15 UTC (rev 2280)
@@ -1,3 +1,13 @@
+2008-08-20  Nicolas François  <nicolas.francois at centraliens.net>
+
+	* NEWS, src/gpasswd.c: Use getopt_long instead of getopt. Added
+	support for long options --add (-a), --delete (-d),
+	--remove-password (-r), --restrict (-R), --administrators (-A),
+	and --members (-M) 
+	* man/gpasswd.1.xml: Document the new long options.
+	* src/gpasswd.c: The sgrp structure is only used if SHADOWGRP is
+	defined.
+
 2008-08-18  Nicolas François  <nicolas.francois at centraliens.net>
 
 	* src/grpck.c: Added function fail_exit(). Check failure to unlock

Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS	2008-08-22 02:27:26 UTC (rev 2279)
+++ upstream/trunk/NEWS	2008-08-22 02:28:15 UTC (rev 2280)
@@ -6,6 +6,10 @@
 - packaging
   * Added support for OpenPAM.
 
+- gpasswd
+  * Added support for long options --add (-a), --delete (-d),
+    --remove-password (-r), --restrict (-R), --administrators (-A), and
+    --members (-M).
 - groupmems
   * Check if user exist before they are added to groups.
   * Avoid segfault in case the specified group does not exist in /etc/group.

Modified: upstream/trunk/man/gpasswd.1.xml
===================================================================
--- upstream/trunk/man/gpasswd.1.xml	2008-08-22 02:27:26 UTC (rev 2279)
+++ upstream/trunk/man/gpasswd.1.xml	2008-08-22 02:28:15 UTC (rev 2280)
@@ -91,7 +91,7 @@
     <variablelist remap='IP'>
       <varlistentry>
 	<term>
-	  <option>-a</option> <replaceable>user</replaceable>
+	  <option>-a</option>, <option>--add</option> <replaceable>user</replaceable>
 	</term>
 	<listitem>
 	  <para>
@@ -104,7 +104,7 @@
     <variablelist remap='IP'>
       <varlistentry>
 	<term>
-	  <option>-d</option> <replaceable>user</replaceable>
+	  <option>-d</option>, <option>--delete</option> <replaceable>user</replaceable>
 	</term>
 	<listitem>
 	  <para>
@@ -117,7 +117,7 @@
     <variablelist remap='IP'>
       <varlistentry>
 	<term>
-	  <option>-r</option>
+	  <option>-r</option>, <option>--remove-password</option>
 	</term>
 	<listitem>
 	  <para>
@@ -132,7 +132,7 @@
     <variablelist remap='IP'>
       <varlistentry>
 	<term>
-	  <option>-R</option>
+	  <option>-R</option>, <option>--restrict</option>
 	</term>
 	<listitem>
 	  <para>
@@ -147,7 +147,7 @@
     <variablelist remap='IP' condition="gshadow">
       <varlistentry>
 	<term>
-	  <option>-A</option> <replaceable>user</replaceable>,...
+	  <option>-A</option>, <option>--administrators</option> <replaceable>user</replaceable>,...
 	</term>
 	<listitem>
 	  <para>
@@ -159,7 +159,7 @@
     <variablelist remap='IP'>
       <varlistentry>
 	<term>
-	  <option>-M</option> <replaceable>user</replaceable>,...
+	  <option>-M</option>, <option>--members</option> <replaceable>user</replaceable>,...
 	</term>
 	<listitem>
 	  <para>

Modified: upstream/trunk/src/gpasswd.c
===================================================================
--- upstream/trunk/src/gpasswd.c	2008-08-22 02:27:26 UTC (rev 2279)
+++ upstream/trunk/src/gpasswd.c	2008-08-22 02:28:15 UTC (rev 2280)
@@ -36,6 +36,7 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <getopt.h>
 #include <grp.h>
 #include <pwd.h>
 #include <signal.h>
@@ -244,8 +245,18 @@
 static void process_flags (int argc, char **argv)
 {
 	int flag;
+	int option_index = 0;
+	static struct option long_options[] = {
+		{"add", required_argument, NULL, 'a'},
+		{"delete", required_argument, NULL, 'd'},
+		{"remove-password", no_argument, NULL, 'r'},
+		{"restrict", no_argument, NULL, 'R'},
+		{"administrators", required_argument, NULL, 'A'},
+		{"members", required_argument, NULL, 'M'},
+		{NULL, 0, NULL, '\0'}
+		};
 
-	while ((flag = getopt (argc, argv, "a:A:d:gM:rR")) != EOF) {
+	while ((flag = getopt_long (argc, argv, "a:A:d:gM:rR", long_options, &option_index)) != -1) {
 		switch (flag) {
 		case 'a':	/* add a user */
 			user = optarg;
@@ -605,7 +616,9 @@
 #endif
 {
 	struct group const*tmpgr = NULL;
+#ifdef SHADOWGRP
 	struct sgrp const*tmpsg = NULL;
+#endif
 
 	if (gr_open (O_RDONLY) == 0) {
 		fprintf (stderr, _("%s: cannot open %s\n"), Prog, gr_dbname ());




More information about the Pkg-shadow-commits mailing list