}
/* append a new user to the passwd file */
-static int addgroup(const char *filename, char *group, gid_t gid)
+static int addgroup(const char *filename, char *group, gid_t gid, const char *user)
{
FILE *etc_group;
/* add entry to group */
etc_group = xfopen(filename, "a");
- fprintf(etc_group, entryfmt, group, default_passwd, gr.gr_gid, "");
+ fprintf(etc_group, entryfmt, group, default_passwd, gr.gr_gid, user);
fclose(etc_group);
int addgroup_main(int argc, char **argv)
{
char *group;
+ char *user;
gid_t gid = 0;
if (argc < 2) {
} else {
show_usage();
}
+
+ if (argc == 4) {
+ user = argv[3];
+ } else {
+ user = "";
+ }
if (geteuid() != 0) {
error_msg_and_die
}
/* werk */
- return addgroup(group_file, group, gid);
+ return addgroup(GROUP_FILE, group, gid, user);
}
-/* $Id: addgroup.c,v 1.6 2002/11/14 11:10:14 andersen Exp $ */
+/* $Id: addgroup.c,v 1.7 2002/12/12 08:57:16 andersen Exp $ */