2
2
* Copyright (c) 2000 , International Business Machines
3
3
* George Kraft IV, gk4@us.ibm.com, 03/23/2000
4
4
* Copyright (c) 2000 - 2006, Tomasz Kłoczko
5
* Copyright (c) 2007 - 2008, Nicolas François
5
* Copyright (c) 2007 - 2009, Nicolas François
6
6
* All rights reserved.
8
8
* Redistribution and use in source and binary forms, with or without
88
88
const struct group *grp);
89
89
static void purge_members (const struct group *grp);
90
90
static void display_members (const char *const *members);
91
static void usage (void);
91
static void usage (int status);
92
92
static void process_flags (int argc, char **argv);
93
93
static void check_perms (void);
94
94
static void fail_exit (int code);
364
static void usage (void)
364
static void usage (int status)
366
(void) fputs (_("Usage: groupmems [options] [action]\n"
369
" -g, --group groupname change groupname instead of the user's group\n"
373
" -a, --add username add username to the members of the group\n"
374
" -d, --delete username remove username from the members of the group\n"
375
" -p, --purge purge all members from the group\n"
376
" -l, --list list the members of the group\n"
378
fail_exit (EXIT_USAGE);
366
FILE *usageout = (EXIT_SUCCESS != status) ? stderr : stdout;
367
(void) fprintf (usageout,
368
_("Usage: %s [options] [action]\n"
372
(void) fputs (_(" -g, --group groupname change groupname instead of the user's group\n"
373
" (root only)\n"), usageout);
374
(void) fputs (_("\n"), usageout);
375
(void) fputs (_("Actions:\n"), usageout);
376
(void) fputs (_(" -a, --add username add username to the members of the group\n"), usageout);
377
(void) fputs (_(" -d, --delete username remove username from the members of the group\n"), usageout);
378
(void) fputs (_(" -h, --help display this help message and exit\n"), usageout);
379
(void) fputs (_(" -p, --purge purge all members from the group\n"), usageout);
380
(void) fputs (_(" -l, --list list the members of the group\n"), usageout);
389
392
{"add", required_argument, NULL, 'a'},
390
393
{"delete", required_argument, NULL, 'd'},
391
394
{"group", required_argument, NULL, 'g'},
395
{"help", no_argument, NULL, 'h'},
392
396
{"list", no_argument, NULL, 'l'},
393
397
{"purge", no_argument, NULL, 'p'},
394
398
{NULL, 0, NULL, '\0'}
397
while ((arg = getopt_long (argc, argv, "a:d:g:lp", long_options,
401
while ((arg = getopt_long (argc, argv, "a:d:g:hlp", long_options,
398
402
&option_index)) != EOF) {