* 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: Use
	booleans for tests.
	* src/userdel.c, src/gpasswd.c, src/groupmems.c, src/usermod.c,
	src/groupmod.c, src/passwd.c: Use a break even after usage().
This commit is contained in:
nekral-guest 2009-09-05 22:31:29 +00:00
parent ff60398b1c
commit 8806b07bd2
18 changed files with 33 additions and 17 deletions

View File

@ -1,3 +1,13 @@
2009-09-06 Nicolas François <nicolas.francois@centraliens.net>
* 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: Use
booleans for tests.
* src/userdel.c, src/gpasswd.c, src/groupmems.c, src/usermod.c,
src/groupmod.c, src/passwd.c: Use a break even after usage().
2009-09-05 Nicolas François <nicolas.francois@centraliens.net> 2009-09-05 Nicolas François <nicolas.francois@centraliens.net>
* src/gpasswd.c, src/groupmems.c: Split the groupmems and gpasswd * src/gpasswd.c, src/groupmems.c: Split the groupmems and gpasswd

View File

@ -168,7 +168,7 @@ static void usage (int status)
" -M, --maxdays MAX_DAYS set maximim number of days before password\n" " -M, --maxdays MAX_DAYS set maximim number of days before password\n"
" change to MAX_DAYS\n" " change to MAX_DAYS\n"
" -W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS\n" " -W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS\n"
"\n"), status ? stderr : stdout); "\n"), (E_SUCCESS != status) ? stderr : stdout);
exit (status); exit (status);
} }

View File

@ -116,7 +116,7 @@ static void fail_exit (int code)
*/ */
static void usage (int status) static void usage (int status)
{ {
fprintf (status ? stderr : stdout, (void) fprintf ((E_SUCCESS != status) ? stderr : stdout,
_("Usage: %s [options]\n" _("Usage: %s [options]\n"
"\n" "\n"
"Options:\n" "Options:\n"

View File

@ -114,7 +114,7 @@ static void fail_exit (int code)
*/ */
static void usage (int status) static void usage (int status)
{ {
FILE *usageout = status ? stderr : stdout; FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
(void) fprintf (usageout, (void) fprintf (usageout,
_("Usage: %s [options]\n" _("Usage: %s [options]\n"
"\n" "\n"

View File

@ -108,7 +108,7 @@ static void usage (int status)
"Options:\n" "Options:\n"
" -h, --help display this help message and exit\n" " -h, --help display this help message and exit\n"
" -s, --shell SHELL new login shell for the user account\n" " -s, --shell SHELL new login shell for the user account\n"
"\n"), status ? stderr : stdout); "\n"), (E_SUCCESS != status) ? stderr : stdout);
exit (status); exit (status);
} }

View File

@ -82,7 +82,7 @@ static struct stat statbuf; /* fstat buffer for file size */
static void usage (int status) static void usage (int status)
{ {
FILE *usageout = status ? stderr : stdout; FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
(void) fprintf (usageout, (void) fprintf (usageout,
_("Usage: %s [options]\n" _("Usage: %s [options]\n"
"\n" "\n"

View File

@ -130,7 +130,7 @@ static void log_gpasswd_success_gshadow (unused void *arg);
*/ */
static void usage (int status) static void usage (int status)
{ {
FILE *usageout = status ? stderr : stdout; FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
(void) fprintf (usageout, (void) fprintf (usageout,
_("Usage: %s [option] GROUP\n" _("Usage: %s [option] GROUP\n"
"\n" "\n"
@ -278,6 +278,7 @@ static void process_flags (int argc, char **argv)
break; break;
case 'h': case 'h':
usage (E_SUCCESS); usage (E_SUCCESS);
break;
case 'M': /* set the list of members */ case 'M': /* set the list of members */
members = optarg; members = optarg;
if (!is_valid_user_list (members)) { if (!is_valid_user_list (members)) {

View File

@ -107,7 +107,7 @@ static void check_perms (void);
*/ */
static void usage (int status) static void usage (int status)
{ {
FILE *usageout = status ? stderr : stdout; FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
(void) fprintf (usageout, (void) fprintf (usageout,
_("Usage: %s [options] GROUP\n" _("Usage: %s [options] GROUP\n"
"\n" "\n"

View File

@ -363,7 +363,7 @@ static void display_members (const char *const *members)
static void usage (int status) static void usage (int status)
{ {
FILE *usageout = status ? stderr : stdout; FILE *usageout = (EXIT_SUCCESS != status) ? stderr : stdout;
(void) fprintf (usageout, (void) fprintf (usageout,
_("Usage: %s [options] [action]\n" _("Usage: %s [options] [action]\n"
"\n" "\n"
@ -414,6 +414,7 @@ static void process_flags (int argc, char **argv)
break; break;
case 'h': case 'h':
usage (EXIT_SUCCESS); usage (EXIT_SUCCESS);
break;
case 'l': case 'l':
list = true; list = true;
++exclusive; ++exclusive;

View File

@ -115,7 +115,7 @@ static void update_primary_groups (gid_t ogid, gid_t ngid);
static void usage (int status) static void usage (int status)
{ {
FILE *usageout = status ? stderr : stdout; FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
(void) fprintf (usageout, (void) fprintf (usageout,
_("Usage: %s [options] GROUP\n" _("Usage: %s [options] GROUP\n"
"\n" "\n"
@ -365,6 +365,7 @@ static void process_flags (int argc, char **argv)
break; break;
case 'h': case 'h':
usage (E_SUCCESS); usage (E_SUCCESS);
break;
case 'n': case 'n':
nflg = true; nflg = true;
group_newname = optarg; group_newname = optarg;

View File

@ -80,7 +80,7 @@ static void usage (int status)
" -h, --help display this help message and exit\n" " -h, --help display this help message and exit\n"
" -t, --time DAYS print only lastlog records more recent than DAYS\n" " -t, --time DAYS print only lastlog records more recent than DAYS\n"
" -u, --user LOGIN print lastlog record of the specified LOGIN\n" " -u, --user LOGIN print lastlog record of the specified LOGIN\n"
"\n"), status ? stderr : stdout); "\n"), (EXIT_SUCCESS != status) ? stderr : stdout);
exit (status); exit (status);
} }

View File

@ -112,7 +112,7 @@ static void close_files (void);
*/ */
static void usage (int status) static void usage (int status)
{ {
FILE *usageout = status ? stderr : stdout; FILE *usageout = (EXIT_SUCCESS != status) ? stderr : stdout;
(void) fprintf (usageout, (void) fprintf (usageout,
_("Usage: %s [options]\n" _("Usage: %s [options]\n"
"\n" "\n"

View File

@ -180,7 +180,7 @@ static void usage (int status)
" -w, --warndays WARN_DAYS set expiration warning days to WARN_DAYS\n" " -w, --warndays WARN_DAYS set expiration warning days to WARN_DAYS\n"
" -x, --maxdays MAX_DAYS set maximum number of days before password\n" " -x, --maxdays MAX_DAYS set maximum number of days before password\n"
" change to MAX_DAYS\n" " change to MAX_DAYS\n"
"\n"), status ? stderr : stdout); "\n"), (E_SUCCESS != status) ? stderr : stdout);
exit (status); exit (status);
} }
@ -899,6 +899,7 @@ int main (int argc, char **argv)
break; break;
case 'h': case 'h':
usage (E_SUCCESS); usage (E_SUCCESS);
break;
default: default:
usage (E_BAD_ARG); usage (E_BAD_ARG);
} }

View File

@ -335,7 +335,7 @@ static void usage (int status)
" --preserve-environment do not reset environment variables, and\n" " --preserve-environment do not reset environment variables, and\n"
" keep the same shell\n" " keep the same shell\n"
" -s, --shell SHELL use SHELL instead of the default in passwd\n" " -s, --shell SHELL use SHELL instead of the default in passwd\n"
"\n"), status ? stderr : stdout); "\n"), (E_SUCCESS != status) ? stderr : stdout);
exit (status); exit (status);
} }

View File

@ -683,7 +683,7 @@ static int get_groups (char *list)
*/ */
static void usage (int status) static void usage (int status)
{ {
FILE *usageout = status ? stderr : stdout; FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
(void) fprintf (usageout, (void) fprintf (usageout,
_("Usage: %s [options] LOGIN\n" _("Usage: %s [options] LOGIN\n"
"\n" "\n"

View File

@ -120,7 +120,7 @@ static void usage (int status)
" even if not owned by user\n" " even if not owned by user\n"
" -h, --help display this help message and exit\n" " -h, --help display this help message and exit\n"
" -r, --remove remove home directory and mail spool\n" " -r, --remove remove home directory and mail spool\n"
"\n"), status ? stderr : stdout); "\n"), (E_SUCCESS != status) ? stderr : stdout);
exit (status); exit (status);
} }
@ -776,6 +776,7 @@ int main (int argc, char **argv)
break; break;
case 'h': case 'h':
usage (E_SUCCESS); usage (E_SUCCESS);
break;
case 'r': /* remove home dir and mailbox */ case 'r': /* remove home dir and mailbox */
rflg = true; rflg = true;
break; break;

View File

@ -302,7 +302,7 @@ static int get_groups (char *list)
*/ */
static void usage (int status) static void usage (int status)
{ {
fprintf (status ? stderr : stdout, fprintf ((E_SUCCESS != status) ? stderr : stdout,
_("Usage: usermod [options] LOGIN\n" _("Usage: usermod [options] LOGIN\n"
"\n" "\n"
"Options:\n" "Options:\n"
@ -978,6 +978,7 @@ static void process_flags (int argc, char **argv)
break; break;
case 'h': case 'h':
usage (E_SUCCESS); usage (E_SUCCESS);
break;
case 'l': case 'l':
if (!is_valid_user_name (optarg)) { if (!is_valid_user_name (optarg)) {
fprintf (stderr, fprintf (stderr,

View File

@ -83,7 +83,7 @@ static void usage (int status)
" -p, --passwd edit passwd database\n" " -p, --passwd edit passwd database\n"
" -q, --quiet quiet mode\n" " -q, --quiet quiet mode\n"
" -s, --shadow edit shadow or gshadow database\n" " -s, --shadow edit shadow or gshadow database\n"
"\n"), status ? stderr : stdout); "\n"), (E_SUCCESS != status) ? stderr : stdout);
exit (status); exit (status);
} }