[Pkg-shadow-commits] r3546 - in upstream/trunk: . man src
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Sun Nov 6 18:38:33 UTC 2011
Author: nekral-guest
Date: 2011-11-06 18:38:32 +0000 (Sun, 06 Nov 2011)
New Revision: 3546
Modified:
upstream/trunk/ChangeLog
upstream/trunk/NEWS
upstream/trunk/man/chsh.1.xml
upstream/trunk/src/chsh.c
Log:
* NEWS, src/chsh.c, man/chsh.1.xml: Add --root option.
chsh's usage split in smaller messages.
* src/chsh.c: The getopt index of long options is not used.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2011-11-06 18:38:26 UTC (rev 3545)
+++ upstream/trunk/ChangeLog 2011-11-06 18:38:32 UTC (rev 3546)
@@ -39,6 +39,9 @@
* NEWS, src/groupmems.c, man/groupmems.8.xml: Add --root option.
Open syslog after the potential chroot.
* src/groupmems.c: The getopt index of long options is not used.
+ * NEWS, src/chsh.c, man/chsh.1.xml: Add --root option.
+ chsh's usage split in smaller messages.
+ * src/chsh.c: The getopt index of long options is not used.
2011-10-22 Nicolas François <nicolas.francois at centraliens.net>
Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS 2011-11-06 18:38:26 UTC (rev 3545)
+++ upstream/trunk/NEWS 2011-11-06 18:38:32 UTC (rev 3546)
@@ -30,6 +30,8 @@
is created if the password is changed and passwd requires a
shadow entry.
* Add --root option.
+- chsh
+ * Add --root option.
- faillog
* The -l, -m, -r, -t options only act on the existing users, unless -a is
specified.
Modified: upstream/trunk/man/chsh.1.xml
===================================================================
--- upstream/trunk/man/chsh.1.xml 2011-11-06 18:38:26 UTC (rev 3545)
+++ upstream/trunk/man/chsh.1.xml 2011-11-06 18:38:32 UTC (rev 3546)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 1990 , Julianne Frances Haugh
- Copyright (c) 2007 - 2008, Nicolas François
+ Copyright (c) 2007 - 2011, Nicolas François
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -86,6 +86,19 @@
</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>
+ <term>
<option>-s</option>, <option>--shell</option> <replaceable>SHELL</replaceable>
</term>
<listitem>
Modified: upstream/trunk/src/chsh.c
===================================================================
--- upstream/trunk/src/chsh.c 2011-11-06 18:38:26 UTC (rev 3545)
+++ upstream/trunk/src/chsh.c 2011-11-06 18:38:32 UTC (rev 3546)
@@ -103,12 +103,16 @@
*/
static void usage (int status)
{
- fputs (_("Usage: chsh [options] [LOGIN]\n"
- "\n"
- "Options:\n"
- " -h, --help display this help message and exit\n"
- " -s, --shell SHELL new login shell for the user account\n"
- "\n"), (E_SUCCESS != status) ? stderr : stdout);
+ FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
+ (void) fprintf (usageout,
+ _("Usage: %s [options] [LOGIN]\n"
+ "\n"
+ "Options:\n"),
+ Prog);
+ (void) fputs (_(" -h, --help display this help message and exit\n"), usageout);
+ (void) fputs (_(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout);
+ (void) fputs (_(" -s, --shell SHELL new login shell for the user account\n"), usageout);
+ (void) fputs ("\n", usageout);
exit (status);
}
@@ -200,21 +204,22 @@
*/
static void process_flags (int argc, char **argv)
{
- int option_index = 0;
int c;
static struct option long_options[] = {
{"help", no_argument, NULL, 'h'},
+ {"root", required_argument, NULL, 'R'},
{"shell", required_argument, NULL, 's'},
{NULL, 0, NULL, '\0'}
};
- while ((c =
- getopt_long (argc, argv, "hs:", long_options,
- &option_index)) != -1) {
+ while ((c = getopt_long (argc, argv, "hR:s:",
+ long_options, NULL)) != -1) {
switch (c) {
case 'h':
usage (E_SUCCESS);
break;
+ case 'R': /* no-op, handled in process_root_flag () */
+ break;
case 's':
sflg = true;
STRFCPY (loginsh, optarg);
@@ -432,21 +437,23 @@
sanitize_env ();
+ /*
+ * Get the program name. The program name is used as a prefix to
+ * most error messages.
+ */
+ Prog = Basename (argv[0]);
+
(void) setlocale (LC_ALL, "");
(void) bindtextdomain (PACKAGE, LOCALEDIR);
(void) textdomain (PACKAGE);
+ process_root_flag ("-R", argc, argv);
+
/*
* This command behaves different for root and non-root users.
*/
amroot = (getuid () == 0);
- /*
- * Get the program name. The program name is used as a prefix to
- * most error messages.
- */
- Prog = Basename (argv[0]);
-
OPENLOG ("chsh");
/* parse the command line options */
More information about the Pkg-shadow-commits
mailing list