1996-12-09 14:05:35 +00:00
|
|
|
/*-
|
1996-12-10 23:59:04 +00:00
|
|
|
* Copyright (C) 1996
|
|
|
|
* David L. Nugent. All rights reserved.
|
1996-12-09 14:05:35 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
1996-12-10 23:59:04 +00:00
|
|
|
* notice, this list of conditions and the following disclaimer.
|
1996-12-09 14:05:35 +00:00
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
1996-12-10 23:59:04 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY DAVID L. NUGENT AND CONTRIBUTORS ``AS IS'' AND
|
1996-12-09 14:05:35 +00:00
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
1996-12-10 23:59:04 +00:00
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL DAVID L. NUGENT OR CONTRIBUTORS BE LIABLE
|
1996-12-09 14:05:35 +00:00
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
1997-10-10 06:23:42 +00:00
|
|
|
#ifndef lint
|
|
|
|
static const char rcsid[] =
|
1999-08-28 01:35:59 +00:00
|
|
|
"$FreeBSD$";
|
1997-10-10 06:23:42 +00:00
|
|
|
#endif /* not lint */
|
|
|
|
|
|
|
|
#include <err.h>
|
1998-08-04 22:31:26 +00:00
|
|
|
#include <fcntl.h>
|
2000-06-22 16:48:41 +00:00
|
|
|
#include <locale.h>
|
2015-08-02 13:22:46 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <sysexits.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
1999-02-23 07:15:11 +00:00
|
|
|
#include "pw.h"
|
1996-12-09 14:05:35 +00:00
|
|
|
|
1999-10-26 08:34:09 +00:00
|
|
|
const char *Modes[] = {
|
|
|
|
"add", "del", "mod", "show", "next",
|
|
|
|
NULL};
|
1996-12-09 14:05:35 +00:00
|
|
|
const char *Which[] = {"user", "group", NULL};
|
1996-12-09 23:55:27 +00:00
|
|
|
static const char *Combo1[] = {
|
|
|
|
"useradd", "userdel", "usermod", "usershow", "usernext",
|
1999-10-26 08:34:09 +00:00
|
|
|
"lock", "unlock",
|
1996-12-09 23:55:27 +00:00
|
|
|
"groupadd", "groupdel", "groupmod", "groupshow", "groupnext",
|
|
|
|
NULL};
|
|
|
|
static const char *Combo2[] = {
|
|
|
|
"adduser", "deluser", "moduser", "showuser", "nextuser",
|
1999-10-26 08:34:09 +00:00
|
|
|
"lock", "unlock",
|
1996-12-09 23:55:27 +00:00
|
|
|
"addgroup", "delgroup", "modgroup", "showgroup", "nextgroup",
|
1999-10-26 08:34:09 +00:00
|
|
|
NULL};
|
1996-12-09 14:05:35 +00:00
|
|
|
|
1999-02-23 07:15:11 +00:00
|
|
|
struct pwf PWF =
|
|
|
|
{
|
2015-06-03 19:08:25 +00:00
|
|
|
PWF_REGULAR,
|
1999-02-23 07:15:11 +00:00
|
|
|
setpwent,
|
|
|
|
endpwent,
|
|
|
|
getpwent,
|
|
|
|
getpwuid,
|
|
|
|
getpwnam,
|
|
|
|
setgrent,
|
|
|
|
endgrent,
|
|
|
|
getgrent,
|
|
|
|
getgrgid,
|
|
|
|
getgrnam,
|
|
|
|
|
|
|
|
};
|
|
|
|
struct pwf VPWF =
|
|
|
|
{
|
2015-06-03 19:08:25 +00:00
|
|
|
PWF_ALT,
|
1999-02-23 07:15:11 +00:00
|
|
|
vsetpwent,
|
|
|
|
vendpwent,
|
|
|
|
vgetpwent,
|
|
|
|
vgetpwuid,
|
|
|
|
vgetpwnam,
|
|
|
|
vsetgrent,
|
|
|
|
vendgrent,
|
|
|
|
vgetgrent,
|
|
|
|
vgetgrgid,
|
|
|
|
vgetgrnam,
|
|
|
|
};
|
|
|
|
|
2015-08-02 12:47:50 +00:00
|
|
|
static int (*cmdfunc[W_NUM][M_NUM])(int argc, char **argv, char *_name) = {
|
|
|
|
{ /* user */
|
|
|
|
pw_user_add,
|
|
|
|
pw_user_del,
|
|
|
|
pw_user_mod,
|
|
|
|
pw_user_show,
|
|
|
|
pw_user_next,
|
|
|
|
pw_user_lock,
|
|
|
|
pw_user_unlock,
|
|
|
|
},
|
|
|
|
{ /* group */
|
|
|
|
pw_group_add,
|
|
|
|
pw_group_del,
|
|
|
|
pw_group_mod,
|
|
|
|
pw_group_show,
|
|
|
|
pw_group_next,
|
|
|
|
}
|
|
|
|
};
|
1996-12-09 14:05:35 +00:00
|
|
|
|
2015-08-02 12:47:50 +00:00
|
|
|
struct pwconf conf;
|
1996-12-09 14:05:35 +00:00
|
|
|
|
2015-08-02 12:47:50 +00:00
|
|
|
static int getindex(const char *words[], const char *word);
|
|
|
|
static void cmdhelp(int mode, int which);
|
1996-12-09 14:05:35 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
2015-08-02 12:47:50 +00:00
|
|
|
int mode = -1, which = -1, tmp;
|
2014-11-12 22:27:53 +00:00
|
|
|
struct stat st;
|
2015-08-02 12:47:50 +00:00
|
|
|
char arg, *arg1;
|
2015-06-07 14:54:07 +00:00
|
|
|
bool relocated, nis;
|
1996-12-09 14:05:35 +00:00
|
|
|
|
2015-08-02 12:47:50 +00:00
|
|
|
arg1 = NULL;
|
2015-06-07 14:54:07 +00:00
|
|
|
relocated = nis = false;
|
2015-06-07 15:29:58 +00:00
|
|
|
memset(&conf, 0, sizeof(conf));
|
2015-07-12 20:29:51 +00:00
|
|
|
strlcpy(conf.rootdir, "/", sizeof(conf.rootdir));
|
2015-06-07 14:34:38 +00:00
|
|
|
strlcpy(conf.etcpath, _PATH_PWD, sizeof(conf.etcpath));
|
2015-07-04 15:27:04 +00:00
|
|
|
conf.fd = -1;
|
2015-07-13 09:12:05 +00:00
|
|
|
conf.checkduplicate = true;
|
2015-06-07 14:34:38 +00:00
|
|
|
|
2015-08-02 12:47:50 +00:00
|
|
|
setlocale(LC_ALL, "");
|
2000-06-22 16:48:41 +00:00
|
|
|
|
1996-12-09 14:05:35 +00:00
|
|
|
/*
|
|
|
|
* Break off the first couple of words to determine what exactly
|
|
|
|
* we're being asked to do
|
|
|
|
*/
|
1999-02-23 07:15:11 +00:00
|
|
|
while (argc > 1) {
|
|
|
|
if (*argv[1] == '-') {
|
|
|
|
/*
|
|
|
|
* Special case, allow pw -V<dir> <operation> [args] for scripts etc.
|
|
|
|
*/
|
2015-06-03 19:08:25 +00:00
|
|
|
arg = argv[1][1];
|
|
|
|
if (arg == 'V' || arg == 'R') {
|
2015-06-07 14:34:38 +00:00
|
|
|
if (relocated)
|
|
|
|
errx(EXIT_FAILURE, "Both '-R' and '-V' "
|
|
|
|
"specified, only one accepted");
|
|
|
|
relocated = true;
|
1999-02-23 07:15:11 +00:00
|
|
|
optarg = &argv[1][2];
|
|
|
|
if (*optarg == '\0') {
|
2014-11-12 22:27:53 +00:00
|
|
|
if (stat(argv[2], &st) != 0)
|
|
|
|
errx(EX_OSFILE, \
|
|
|
|
"no such directory `%s'",
|
|
|
|
argv[2]);
|
|
|
|
if (!S_ISDIR(st.st_mode))
|
|
|
|
errx(EX_OSFILE, "`%s' not a "
|
|
|
|
"directory", argv[2]);
|
1999-02-23 07:15:11 +00:00
|
|
|
optarg = argv[2];
|
|
|
|
++argv;
|
|
|
|
--argc;
|
|
|
|
}
|
2015-06-07 14:34:38 +00:00
|
|
|
memcpy(&PWF, &VPWF, sizeof PWF);
|
|
|
|
if (arg == 'R') {
|
|
|
|
strlcpy(conf.rootdir, optarg,
|
|
|
|
sizeof(conf.rootdir));
|
|
|
|
PWF._altdir = PWF_ROOTDIR;
|
|
|
|
}
|
|
|
|
snprintf(conf.etcpath, sizeof(conf.etcpath),
|
|
|
|
"%s%s", optarg, arg == 'R' ? "/etc" : "");
|
1999-02-23 10:35:47 +00:00
|
|
|
} else
|
|
|
|
break;
|
1999-02-23 07:15:11 +00:00
|
|
|
}
|
2000-06-18 02:39:17 +00:00
|
|
|
else if (mode == -1 && (tmp = getindex(Modes, argv[1])) != -1)
|
1996-12-09 14:05:35 +00:00
|
|
|
mode = tmp;
|
2000-06-18 02:39:17 +00:00
|
|
|
else if (which == -1 && (tmp = getindex(Which, argv[1])) != -1)
|
1996-12-09 14:05:35 +00:00
|
|
|
which = tmp;
|
2000-06-18 02:39:17 +00:00
|
|
|
else if ((mode == -1 && which == -1) &&
|
|
|
|
((tmp = getindex(Combo1, argv[1])) != -1 ||
|
|
|
|
(tmp = getindex(Combo2, argv[1])) != -1)) {
|
1996-12-09 14:05:35 +00:00
|
|
|
which = tmp / M_NUM;
|
|
|
|
mode = tmp % M_NUM;
|
2000-06-18 02:39:17 +00:00
|
|
|
} else if (strcmp(argv[1], "help") == 0 && argv[2] == NULL)
|
1996-12-09 14:05:35 +00:00
|
|
|
cmdhelp(mode, which);
|
2015-08-02 12:47:50 +00:00
|
|
|
else if (which != -1 && mode != -1)
|
|
|
|
arg1 = argv[1];
|
|
|
|
else
|
1997-10-10 06:23:42 +00:00
|
|
|
errx(EX_USAGE, "unknown keyword `%s'", argv[1]);
|
1996-12-09 14:05:35 +00:00
|
|
|
++argv;
|
|
|
|
--argc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Bail out unless the user is specific!
|
|
|
|
*/
|
|
|
|
if (mode == -1 || which == -1)
|
|
|
|
cmdhelp(mode, which);
|
|
|
|
|
2015-07-12 20:29:51 +00:00
|
|
|
conf.rootfd = open(conf.rootdir, O_DIRECTORY|O_CLOEXEC);
|
|
|
|
if (conf.rootfd == -1)
|
|
|
|
errx(EXIT_FAILURE, "Unable to open '%s'", conf.rootdir);
|
1996-12-09 23:55:27 +00:00
|
|
|
|
2015-08-02 12:47:50 +00:00
|
|
|
return (cmdfunc[which][mode](argc, argv, arg1));
|
1996-12-09 14:05:35 +00:00
|
|
|
}
|
|
|
|
|
1998-08-04 22:31:26 +00:00
|
|
|
|
1996-12-09 14:05:35 +00:00
|
|
|
static int
|
|
|
|
getindex(const char *words[], const char *word)
|
|
|
|
{
|
2015-08-02 12:47:50 +00:00
|
|
|
int i = 0;
|
1996-12-09 14:05:35 +00:00
|
|
|
|
|
|
|
while (words[i]) {
|
|
|
|
if (strcmp(words[i], word) == 0)
|
2015-08-02 12:47:50 +00:00
|
|
|
return (i);
|
1996-12-09 14:05:35 +00:00
|
|
|
i++;
|
|
|
|
}
|
2015-08-02 12:47:50 +00:00
|
|
|
return (-1);
|
1996-12-09 14:05:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is probably an overkill for a cmdline help system, but it reflects
|
|
|
|
* the complexity of the command line.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
cmdhelp(int mode, int which)
|
|
|
|
{
|
|
|
|
if (which == -1)
|
1999-10-26 08:34:09 +00:00
|
|
|
fprintf(stderr, "usage:\n pw [user|group|lock|unlock] [add|del|mod|show|next] [help|switches/values]\n");
|
1996-12-09 14:05:35 +00:00
|
|
|
else if (mode == -1)
|
1999-10-26 08:34:09 +00:00
|
|
|
fprintf(stderr, "usage:\n pw %s [add|del|mod|show|next] [help|switches/values]\n", Which[which]);
|
1996-12-09 14:05:35 +00:00
|
|
|
else {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We need to give mode specific help
|
|
|
|
*/
|
|
|
|
static const char *help[W_NUM][M_NUM] =
|
|
|
|
{
|
|
|
|
{
|
1997-10-10 06:23:42 +00:00
|
|
|
"usage: pw useradd [name] [switches]\n"
|
1999-02-23 07:15:11 +00:00
|
|
|
"\t-V etcdir alternate /etc location\n"
|
2015-10-09 14:55:55 +00:00
|
|
|
"\t-R rootdir alternate root directory\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-C config configuration file\n"
|
|
|
|
"\t-q quiet operation\n"
|
|
|
|
" Adding users:\n"
|
|
|
|
"\t-n name login name\n"
|
|
|
|
"\t-u uid user id\n"
|
|
|
|
"\t-c comment user name/comment\n"
|
|
|
|
"\t-d directory home directory\n"
|
|
|
|
"\t-e date account expiry date\n"
|
|
|
|
"\t-p date password expiry date\n"
|
|
|
|
"\t-g grp initial group\n"
|
|
|
|
"\t-G grp1,grp2 additional groups\n"
|
|
|
|
"\t-m [ -k dir ] create and set up home\n"
|
2007-03-30 10:02:47 +00:00
|
|
|
"\t-M mode home directory permissions\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-s shell name of login shell\n"
|
|
|
|
"\t-o duplicate uid ok\n"
|
|
|
|
"\t-L class user class\n"
|
|
|
|
"\t-h fd read password on fd\n"
|
2004-01-11 18:28:08 +00:00
|
|
|
"\t-H fd read encrypted password on fd\n"
|
1997-01-05 07:15:37 +00:00
|
|
|
"\t-Y update NIS maps\n"
|
1996-12-09 23:55:27 +00:00
|
|
|
"\t-N no update\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
" Setting defaults:\n"
|
1999-02-23 07:15:11 +00:00
|
|
|
"\t-V etcdir alternate /etc location\n"
|
2015-10-09 14:55:55 +00:00
|
|
|
"\t-R rootdir alternate root directory\n"
|
2015-08-02 12:47:50 +00:00
|
|
|
"\t-D set user defaults\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-b dir default home root dir\n"
|
|
|
|
"\t-e period default expiry period\n"
|
|
|
|
"\t-p period default password change period\n"
|
|
|
|
"\t-g group default group\n"
|
|
|
|
"\t-G grp1,grp2 additional groups\n"
|
|
|
|
"\t-L class default user class\n"
|
|
|
|
"\t-k dir default home skeleton\n"
|
2007-03-30 11:23:10 +00:00
|
|
|
"\t-M mode home directory permissions\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-u min,max set min,max uids\n"
|
|
|
|
"\t-i min,max set min,max gids\n"
|
|
|
|
"\t-w method set default password method\n"
|
1997-01-05 07:15:37 +00:00
|
|
|
"\t-s shell default shell\n"
|
|
|
|
"\t-y path set NIS passwd file path\n",
|
1997-10-10 06:23:42 +00:00
|
|
|
"usage: pw userdel [uid|name] [switches]\n"
|
1999-02-23 07:15:11 +00:00
|
|
|
"\t-V etcdir alternate /etc location\n"
|
2015-10-09 14:55:55 +00:00
|
|
|
"\t-R rootdir alternate root directory\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-n name login name\n"
|
|
|
|
"\t-u uid user id\n"
|
1997-01-05 07:15:37 +00:00
|
|
|
"\t-Y update NIS maps\n"
|
2015-08-02 12:47:50 +00:00
|
|
|
"\t-y path set NIS passwd file path\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-r remove home & contents\n",
|
1997-10-10 06:23:42 +00:00
|
|
|
"usage: pw usermod [uid|name] [switches]\n"
|
1999-02-23 07:15:11 +00:00
|
|
|
"\t-V etcdir alternate /etc location\n"
|
2015-10-09 14:55:55 +00:00
|
|
|
"\t-R rootdir alternate root directory\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-C config configuration file\n"
|
|
|
|
"\t-q quiet operation\n"
|
|
|
|
"\t-F force add if no user\n"
|
|
|
|
"\t-n name login name\n"
|
|
|
|
"\t-u uid user id\n"
|
|
|
|
"\t-c comment user name/comment\n"
|
|
|
|
"\t-d directory home directory\n"
|
|
|
|
"\t-e date account expiry date\n"
|
|
|
|
"\t-p date password expiry date\n"
|
|
|
|
"\t-g grp initial group\n"
|
|
|
|
"\t-G grp1,grp2 additional groups\n"
|
|
|
|
"\t-l name new login name\n"
|
|
|
|
"\t-L class user class\n"
|
|
|
|
"\t-m [ -k dir ] create and set up home\n"
|
2007-03-30 10:02:47 +00:00
|
|
|
"\t-M mode home directory permissions\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-s shell name of login shell\n"
|
1996-12-09 23:55:27 +00:00
|
|
|
"\t-w method set new password using method\n"
|
|
|
|
"\t-h fd read password on fd\n"
|
2004-01-11 18:28:08 +00:00
|
|
|
"\t-H fd read encrypted password on fd\n"
|
1997-01-05 07:15:37 +00:00
|
|
|
"\t-Y update NIS maps\n"
|
2015-08-02 12:47:50 +00:00
|
|
|
"\t-y path set NIS passwd file path\n"
|
1996-12-09 23:55:27 +00:00
|
|
|
"\t-N no update\n",
|
1997-10-10 06:23:42 +00:00
|
|
|
"usage: pw usershow [uid|name] [switches]\n"
|
1999-02-23 07:15:11 +00:00
|
|
|
"\t-V etcdir alternate /etc location\n"
|
2015-10-09 14:55:55 +00:00
|
|
|
"\t-R rootdir alternate root directory\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-n name login name\n"
|
|
|
|
"\t-u uid user id\n"
|
|
|
|
"\t-F force print\n"
|
1996-12-09 23:55:27 +00:00
|
|
|
"\t-P prettier format\n"
|
1999-03-02 00:53:33 +00:00
|
|
|
"\t-a print all users\n"
|
|
|
|
"\t-7 print in v7 format\n",
|
1997-10-10 06:23:42 +00:00
|
|
|
"usage: pw usernext [switches]\n"
|
1999-02-23 07:15:11 +00:00
|
|
|
"\t-V etcdir alternate /etc location\n"
|
2015-10-09 14:55:55 +00:00
|
|
|
"\t-R rootdir alternate root directory\n"
|
2015-06-08 05:27:34 +00:00
|
|
|
"\t-C config configuration file\n"
|
|
|
|
"\t-q quiet operation\n",
|
2001-03-14 03:24:30 +00:00
|
|
|
"usage pw: lock [switches]\n"
|
|
|
|
"\t-V etcdir alternate /etc locations\n"
|
|
|
|
"\t-C config configuration file\n"
|
|
|
|
"\t-q quiet operation\n",
|
|
|
|
"usage pw: unlock [switches]\n"
|
|
|
|
"\t-V etcdir alternate /etc locations\n"
|
|
|
|
"\t-C config configuration file\n"
|
|
|
|
"\t-q quiet operation\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
},
|
|
|
|
{
|
1997-10-10 06:23:42 +00:00
|
|
|
"usage: pw groupadd [group|gid] [switches]\n"
|
1999-02-23 07:15:11 +00:00
|
|
|
"\t-V etcdir alternate /etc location\n"
|
2015-10-09 14:55:55 +00:00
|
|
|
"\t-R rootdir alternate root directory\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-C config configuration file\n"
|
|
|
|
"\t-q quiet operation\n"
|
|
|
|
"\t-n group group name\n"
|
|
|
|
"\t-g gid group id\n"
|
1996-12-09 23:55:27 +00:00
|
|
|
"\t-M usr1,usr2 add users as group members\n"
|
|
|
|
"\t-o duplicate gid ok\n"
|
1997-01-05 07:15:37 +00:00
|
|
|
"\t-Y update NIS maps\n"
|
1996-12-09 23:55:27 +00:00
|
|
|
"\t-N no update\n",
|
1997-10-10 06:23:42 +00:00
|
|
|
"usage: pw groupdel [group|gid] [switches]\n"
|
1999-02-23 07:15:11 +00:00
|
|
|
"\t-V etcdir alternate /etc location\n"
|
2015-10-09 14:55:55 +00:00
|
|
|
"\t-R rootdir alternate root directory\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-n name group name\n"
|
1997-01-05 07:15:37 +00:00
|
|
|
"\t-g gid group id\n"
|
|
|
|
"\t-Y update NIS maps\n",
|
1997-10-10 06:23:42 +00:00
|
|
|
"usage: pw groupmod [group|gid] [switches]\n"
|
1999-02-23 07:15:11 +00:00
|
|
|
"\t-V etcdir alternate /etc location\n"
|
2015-10-09 14:55:55 +00:00
|
|
|
"\t-R rootdir alternate root directory\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-C config configuration file\n"
|
|
|
|
"\t-q quiet operation\n"
|
|
|
|
"\t-F force add if not exists\n"
|
|
|
|
"\t-n name group name\n"
|
|
|
|
"\t-g gid group id\n"
|
1996-12-09 23:55:27 +00:00
|
|
|
"\t-M usr1,usr2 replaces users as group members\n"
|
|
|
|
"\t-m usr1,usr2 add users as group members\n"
|
2008-02-23 01:25:22 +00:00
|
|
|
"\t-d usr1,usr2 delete users as group members\n"
|
1996-12-09 23:55:27 +00:00
|
|
|
"\t-l name new group name\n"
|
1997-01-05 07:15:37 +00:00
|
|
|
"\t-Y update NIS maps\n"
|
1996-12-09 23:55:27 +00:00
|
|
|
"\t-N no update\n",
|
1997-10-10 06:23:42 +00:00
|
|
|
"usage: pw groupshow [group|gid] [switches]\n"
|
1999-02-23 07:15:11 +00:00
|
|
|
"\t-V etcdir alternate /etc location\n"
|
2015-10-09 14:55:55 +00:00
|
|
|
"\t-R rootdir alternate root directory\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
"\t-n name group name\n"
|
|
|
|
"\t-g gid group id\n"
|
|
|
|
"\t-F force print\n"
|
1996-12-09 23:55:27 +00:00
|
|
|
"\t-P prettier format\n"
|
|
|
|
"\t-a print all accounting groups\n",
|
1997-10-10 06:23:42 +00:00
|
|
|
"usage: pw groupnext [switches]\n"
|
1999-02-23 07:15:11 +00:00
|
|
|
"\t-V etcdir alternate /etc location\n"
|
2015-10-09 14:55:55 +00:00
|
|
|
"\t-R rootdir alternate root directory\n"
|
1996-12-09 23:55:27 +00:00
|
|
|
"\t-C config configuration file\n"
|
2015-06-08 05:27:34 +00:00
|
|
|
"\t-q quiet operation\n"
|
1996-12-09 14:05:35 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2001-07-05 08:01:15 +00:00
|
|
|
fprintf(stderr, "%s", help[which][mode]);
|
1996-12-09 14:05:35 +00:00
|
|
|
}
|
1996-12-09 23:55:27 +00:00
|
|
|
exit(EXIT_FAILURE);
|
1996-12-09 14:05:35 +00:00
|
|
|
}
|