* NEWS, src/userdel.c, src/lastlog.c, src/gpasswd.c,

src/newusers.c, src/chpasswd.c, src/groupmems.c, src/usermod.c,
	src/chgpasswd.c, src/vipw.c, src/su.c, src/useradd.c,
	src/groupmod.c, src/passwd.c, src/groupadd.c, src/chage.c,
	src/faillog.c, src/chsh.c: If someone uses the -h/--help options,
	the usage should not go to stderr nor should the utility exit with
	non-zero status. All of the shadow utils do just this
	unfortunately, so convert them over to sanity.
	* man/groupmems.8.xml, man/gpasswd.1.xml: Added option -h/--help.
This commit is contained in:
nekral-guest
2009-09-04 23:02:33 +00:00
parent 3d10e75117
commit 91b60a955c
21 changed files with 271 additions and 205 deletions

View File

@ -71,7 +71,7 @@ static bool bflg = false; /* print excludes most recent days */
#define NOW (time ((time_t *) 0))
static void usage (void)
static void usage (int status)
{
fputs (_("Usage: lastlog [options]\n"
"\n"
@ -80,8 +80,8 @@ static void usage (void)
" -h, --help display this help message and exit\n"
" -t, --time DAYS print only lastlog records more recent than DAYS\n"
" -u, --user LOGIN print lastlog record of the specified LOGIN\n"
"\n"), stderr);
exit (EXIT_FAILURE);
"\n"), status ? stderr : stdout);
exit (status);
}
static void print_one (/*@null@*/const struct passwd *pw)
@ -208,7 +208,7 @@ int main (int argc, char **argv)
NULL)) != -1) {
switch (c) {
case 'h':
usage ();
usage (EXIT_SUCCESS);
break;
case 't':
{
@ -267,7 +267,7 @@ int main (int argc, char **argv)
break;
}
default:
usage ();
usage (EXIT_FAILURE);
break;
}
}
@ -275,7 +275,7 @@ int main (int argc, char **argv)
fprintf (stderr,
_("lastlog: unexpected argument: %s\n"),
argv[optind]);
usage();
usage (EXIT_FAILURE);
}
}