From: nekral-guest Date: Sat, 5 Sep 2009 22:31:29 +0000 (+0000) Subject: * src/userdel.c, src/lastlog.c, src/gpasswd.c, src/newusers.c, X-Git-Tag: 4.1.5~388 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8806b07bd238e50609bebe133251fd627786b371;p=shadow * 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(). --- diff --git a/ChangeLog b/ChangeLog index 0910d8d6..3cec6d0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-09-06 Nicolas François + + * 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 * src/gpasswd.c, src/groupmems.c: Split the groupmems and gpasswd diff --git a/src/chage.c b/src/chage.c index ebd3c253..f8b27b05 100644 --- a/src/chage.c +++ b/src/chage.c @@ -168,7 +168,7 @@ static void usage (int status) " -M, --maxdays MAX_DAYS set maximim number of days before password\n" " change to MAX_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); } diff --git a/src/chgpasswd.c b/src/chgpasswd.c index 581e96bd..da4560ef 100644 --- a/src/chgpasswd.c +++ b/src/chgpasswd.c @@ -116,7 +116,7 @@ static void fail_exit (int code) */ static void usage (int status) { - fprintf (status ? stderr : stdout, + (void) fprintf ((E_SUCCESS != status) ? stderr : stdout, _("Usage: %s [options]\n" "\n" "Options:\n" diff --git a/src/chpasswd.c b/src/chpasswd.c index b8922915..63158d1e 100644 --- a/src/chpasswd.c +++ b/src/chpasswd.c @@ -114,7 +114,7 @@ static void fail_exit (int code) */ static void usage (int status) { - FILE *usageout = status ? stderr : stdout; + FILE *usageout = (E_SUCCESS != status) ? stderr : stdout; (void) fprintf (usageout, _("Usage: %s [options]\n" "\n" diff --git a/src/chsh.c b/src/chsh.c index 5a98234b..c0dc948c 100644 --- a/src/chsh.c +++ b/src/chsh.c @@ -108,7 +108,7 @@ static void usage (int status) "Options:\n" " -h, --help display this help message and exit\n" " -s, --shell SHELL new login shell for the user account\n" - "\n"), status ? stderr : stdout); + "\n"), (E_SUCCESS != status) ? stderr : stdout); exit (status); } diff --git a/src/faillog.c b/src/faillog.c index 47e9b3d7..abd4a9ff 100644 --- a/src/faillog.c +++ b/src/faillog.c @@ -82,7 +82,7 @@ static struct stat statbuf; /* fstat buffer for file size */ static void usage (int status) { - FILE *usageout = status ? stderr : stdout; + FILE *usageout = (E_SUCCESS != status) ? stderr : stdout; (void) fprintf (usageout, _("Usage: %s [options]\n" "\n" diff --git a/src/gpasswd.c b/src/gpasswd.c index d3682bd2..9c6ca6a2 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -130,7 +130,7 @@ static void log_gpasswd_success_gshadow (unused void *arg); */ static void usage (int status) { - FILE *usageout = status ? stderr : stdout; + FILE *usageout = (E_SUCCESS != status) ? stderr : stdout; (void) fprintf (usageout, _("Usage: %s [option] GROUP\n" "\n" @@ -278,6 +278,7 @@ static void process_flags (int argc, char **argv) break; case 'h': usage (E_SUCCESS); + break; case 'M': /* set the list of members */ members = optarg; if (!is_valid_user_list (members)) { diff --git a/src/groupadd.c b/src/groupadd.c index 1a0f7cba..35b1da18 100644 --- a/src/groupadd.c +++ b/src/groupadd.c @@ -107,7 +107,7 @@ static void check_perms (void); */ static void usage (int status) { - FILE *usageout = status ? stderr : stdout; + FILE *usageout = (E_SUCCESS != status) ? stderr : stdout; (void) fprintf (usageout, _("Usage: %s [options] GROUP\n" "\n" diff --git a/src/groupmems.c b/src/groupmems.c index 91e89a5d..8202cf90 100644 --- a/src/groupmems.c +++ b/src/groupmems.c @@ -363,7 +363,7 @@ static void display_members (const char *const *members) static void usage (int status) { - FILE *usageout = status ? stderr : stdout; + FILE *usageout = (EXIT_SUCCESS != status) ? stderr : stdout; (void) fprintf (usageout, _("Usage: %s [options] [action]\n" "\n" @@ -414,6 +414,7 @@ static void process_flags (int argc, char **argv) break; case 'h': usage (EXIT_SUCCESS); + break; case 'l': list = true; ++exclusive; diff --git a/src/groupmod.c b/src/groupmod.c index 1951ec30..4205df20 100644 --- a/src/groupmod.c +++ b/src/groupmod.c @@ -115,7 +115,7 @@ static void update_primary_groups (gid_t ogid, gid_t ngid); static void usage (int status) { - FILE *usageout = status ? stderr : stdout; + FILE *usageout = (E_SUCCESS != status) ? stderr : stdout; (void) fprintf (usageout, _("Usage: %s [options] GROUP\n" "\n" @@ -365,6 +365,7 @@ static void process_flags (int argc, char **argv) break; case 'h': usage (E_SUCCESS); + break; case 'n': nflg = true; group_newname = optarg; diff --git a/src/lastlog.c b/src/lastlog.c index 173b6548..43008c75 100644 --- a/src/lastlog.c +++ b/src/lastlog.c @@ -80,7 +80,7 @@ static void usage (int status) " -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"), status ? stderr : stdout); + "\n"), (EXIT_SUCCESS != status) ? stderr : stdout); exit (status); } diff --git a/src/newusers.c b/src/newusers.c index ce3564a6..a7793ab3 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -112,7 +112,7 @@ static void close_files (void); */ static void usage (int status) { - FILE *usageout = status ? stderr : stdout; + FILE *usageout = (EXIT_SUCCESS != status) ? stderr : stdout; (void) fprintf (usageout, _("Usage: %s [options]\n" "\n" diff --git a/src/passwd.c b/src/passwd.c index a2e367f7..8e65b674 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -180,7 +180,7 @@ static void usage (int status) " -w, --warndays WARN_DAYS set expiration warning days to WARN_DAYS\n" " -x, --maxdays MAX_DAYS set maximum number of days before password\n" " change to MAX_DAYS\n" - "\n"), status ? stderr : stdout); + "\n"), (E_SUCCESS != status) ? stderr : stdout); exit (status); } @@ -899,6 +899,7 @@ int main (int argc, char **argv) break; case 'h': usage (E_SUCCESS); + break; default: usage (E_BAD_ARG); } diff --git a/src/su.c b/src/su.c index 29f8317f..716cbf63 100644 --- a/src/su.c +++ b/src/su.c @@ -335,7 +335,7 @@ static void usage (int status) " --preserve-environment do not reset environment variables, and\n" " keep the same shell\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); } diff --git a/src/useradd.c b/src/useradd.c index ec820af6..e189d2f4 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -683,7 +683,7 @@ static int get_groups (char *list) */ static void usage (int status) { - FILE *usageout = status ? stderr : stdout; + FILE *usageout = (E_SUCCESS != status) ? stderr : stdout; (void) fprintf (usageout, _("Usage: %s [options] LOGIN\n" "\n" diff --git a/src/userdel.c b/src/userdel.c index 7129b7c1..d59eaeb4 100644 --- a/src/userdel.c +++ b/src/userdel.c @@ -120,7 +120,7 @@ static void usage (int status) " even if not owned by user\n" " -h, --help display this help message and exit\n" " -r, --remove remove home directory and mail spool\n" - "\n"), status ? stderr : stdout); + "\n"), (E_SUCCESS != status) ? stderr : stdout); exit (status); } @@ -776,6 +776,7 @@ int main (int argc, char **argv) break; case 'h': usage (E_SUCCESS); + break; case 'r': /* remove home dir and mailbox */ rflg = true; break; diff --git a/src/usermod.c b/src/usermod.c index 7eb5c819..ab92009c 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -302,7 +302,7 @@ static int get_groups (char *list) */ static void usage (int status) { - fprintf (status ? stderr : stdout, + fprintf ((E_SUCCESS != status) ? stderr : stdout, _("Usage: usermod [options] LOGIN\n" "\n" "Options:\n" @@ -978,6 +978,7 @@ static void process_flags (int argc, char **argv) break; case 'h': usage (E_SUCCESS); + break; case 'l': if (!is_valid_user_name (optarg)) { fprintf (stderr, diff --git a/src/vipw.c b/src/vipw.c index 583fd24f..746da8c1 100644 --- a/src/vipw.c +++ b/src/vipw.c @@ -83,7 +83,7 @@ static void usage (int status) " -p, --passwd edit passwd database\n" " -q, --quiet quiet mode\n" " -s, --shadow edit shadow or gshadow database\n" - "\n"), status ? stderr : stdout); + "\n"), (E_SUCCESS != status) ? stderr : stdout); exit (status); }