[TinyLogin] addgroup --system
Philip Blundell
pb at nexus.co.uk
Mon Jun 7 11:29:16 MDT 2004
This patch makes addgroup accept (and ignore) the --system argument, for
compatibility with other implementations.
Thanks
p.
-------------- next part --------------
Index: addgroup.c
===================================================================
RCS file: /var/cvs/tinylogin/addgroup.c,v
retrieving revision 1.23
diff -u -r1.23 addgroup.c
--- a/addgroup.c 9 Jan 2003 18:43:29 -0000 1.23
+++ b/addgroup.c 7 Jun 2004 17:25:14 -0000
@@ -31,6 +31,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include <getopt.h>
#include "tinylogin.h"
#define GROUP_FILE "/etc/group"
@@ -124,6 +125,11 @@
return 0;
}
+static struct option long_options[] = {
+ { "system", 0, NULL, 'S' },
+ { 0, 0, 0, 0 }
+};
+
/*
* addgroup will take a login_name as its first parameter.
*
@@ -136,14 +142,19 @@
int opt;
char *group;
char *user;
+ int option_index = -1;
gid_t gid = 0;
+ int system = 0;
/* get remaining args */
- while ((opt = getopt (argc, argv, "g:")) != -1) {
+ while ((opt = getopt_long (argc, argv, "g:S", long_options, &option_index)) != -1) {
switch (opt) {
case 'g':
gid = strtol(optarg, NULL, 10);
break;
+ case 'S':
+ system = 1;
+ break;
default:
show_usage();
break;
More information about the tinylogin
mailing list