* NEWS, src/vipw.c, man/vipw.8.xml: Add --root option.

This commit is contained in:
nekral-guest 2011-11-06 18:39:09 +00:00
parent a2d23700e4
commit e2068416c9
3 changed files with 29 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2011-10-30 Nicolas François <nicolas.francois@centraliens.net>
* NEWS, src/vipw.c, man/vipw.8.xml: Add --root option.
2011-10-30 Nicolas François <nicolas.francois@centraliens.net> 2011-10-30 Nicolas François <nicolas.francois@centraliens.net>
* NEWS, src/faillog.c, man/faillog.8.xml: Add --root option. * NEWS, src/faillog.c, man/faillog.8.xml: Add --root option.

View File

@ -2,7 +2,7 @@
<!-- <!--
Copyright (c) 1997 , Marek Michałkiewicz Copyright (c) 1997 , Marek Michałkiewicz
Copyright (c) 2001 - 2006, Tomasz Kłoczko Copyright (c) 2001 - 2006, Tomasz Kłoczko
Copyright (c) 2007 - 2009, Nicolas François Copyright (c) 2007 - 2011, Nicolas François
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -115,6 +115,19 @@
<para>Quiet mode.</para> <para>Quiet mode.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<option>-R</option>, <option>--root</option>
<replaceable>CHROOT_DIR</replaceable>
</term>
<listitem>
<para>
Apply changes in the <replaceable>CHROOT_DIR</replaceable>
directory and use the configuration files from the
<replaceable>CHROOT_DIR</replaceable> directory.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>-s</option>, <option>--shadow</option></term> <term><option>-s</option>, <option>--shadow</option></term>
<listitem> <listitem>

View File

@ -5,7 +5,7 @@
Copyright (c) 1997 , Guy Maor <maor@ece.utexas.edu> Copyright (c) 1997 , Guy Maor <maor@ece.utexas.edu>
Copyright (c) 1999 - 2000, Marek Michałkiewicz Copyright (c) 1999 - 2000, Marek Michałkiewicz
Copyright (c) 2002 - 2006, Tomasz Kłoczko Copyright (c) 2002 - 2006, Tomasz Kłoczko
Copyright (c) 2007 - 2010, Nicolas François Copyright (c) 2007 - 2011, Nicolas François
All rights reserved. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@ -93,6 +93,7 @@ static void usage (int status)
(void) fputs (_(" -h, --help display this help message and exit\n"), usageout); (void) fputs (_(" -h, --help display this help message and exit\n"), usageout);
(void) fputs (_(" -p, --passwd edit passwd database\n"), usageout); (void) fputs (_(" -p, --passwd edit passwd database\n"), usageout);
(void) fputs (_(" -q, --quiet quiet mode\n"), usageout); (void) fputs (_(" -q, --quiet quiet mode\n"), usageout);
(void) fputs (_(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout);
(void) fputs (_(" -s, --shadow edit shadow or gshadow database\n"), usageout); (void) fputs (_(" -s, --shadow edit shadow or gshadow database\n"), usageout);
#ifdef WITH_TCB #ifdef WITH_TCB
(void) fputs (_(" -u, --user which user's tcb shadow file to edit\n"), usageout); (void) fputs (_(" -u, --user which user's tcb shadow file to edit\n"), usageout);
@ -415,11 +416,14 @@ int main (int argc, char **argv)
char *a; char *a;
bool do_vipw; bool do_vipw;
Prog = Basename (argv[0]);
(void) setlocale (LC_ALL, ""); (void) setlocale (LC_ALL, "");
(void) bindtextdomain (PACKAGE, LOCALEDIR); (void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE); (void) textdomain (PACKAGE);
Prog = ((a = strrchr (*argv, '/')) ? a + 1 : *argv); process_root_flag ("-R", argc, argv);
do_vipw = (strcmp (Prog, "vigr") != 0); do_vipw = (strcmp (Prog, "vigr") != 0);
OPENLOG (do_vipw ? "vipw" : "vigr"); OPENLOG (do_vipw ? "vipw" : "vigr");
@ -434,6 +438,7 @@ int main (int argc, char **argv)
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{"passwd", no_argument, NULL, 'p'}, {"passwd", no_argument, NULL, 'p'},
{"quiet", no_argument, NULL, 'q'}, {"quiet", no_argument, NULL, 'q'},
{"root", required_argument, NULL, 'R'},
{"shadow", no_argument, NULL, 's'}, {"shadow", no_argument, NULL, 's'},
#ifdef WITH_TCB #ifdef WITH_TCB
{"user", required_argument, NULL, 'u'}, {"user", required_argument, NULL, 'u'},
@ -442,9 +447,9 @@ int main (int argc, char **argv)
}; };
while ((c = getopt_long (argc, argv, while ((c = getopt_long (argc, argv,
#ifdef WITH_TCB #ifdef WITH_TCB
"ghpqsu:", "ghpqR:su:",
#else /* !WITH_TCB */ #else /* !WITH_TCB */
"ghpqs", "ghpqR:s",
#endif /* !WITH_TCB */ #endif /* !WITH_TCB */
long_options, NULL)) != -1) { long_options, NULL)) != -1) {
switch (c) { switch (c) {
@ -460,6 +465,8 @@ int main (int argc, char **argv)
case 'q': case 'q':
quiet = true; quiet = true;
break; break;
case 'R': /* no-op, handled in process_root_flag () */
break;
case 's': case 's':
editshadow = true; editshadow = true;
break; break;