diff options
author | Ruediger Meier | 2017-06-19 20:52:50 +0200 |
---|---|---|
committer | Ruediger Meier | 2017-06-26 14:38:24 +0200 |
commit | 6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e (patch) | |
tree | 5e74a0cd99493e934780db2b434c75e995a6bd17 /login-utils/chsh.c | |
parent | misc: never use usage(ERROR) (diff) | |
download | kernel-qcow2-util-linux-6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e.tar.gz kernel-qcow2-util-linux-6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e.tar.xz kernel-qcow2-util-linux-6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e.zip |
misc: never use usage(stderr)
Here we fix all cases where we have usage(FILE*)
functions.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'login-utils/chsh.c')
-rw-r--r-- | login-utils/chsh.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/login-utils/chsh.c b/login-utils/chsh.c index 10b0bdcda..1083583b9 100644 --- a/login-utils/chsh.c +++ b/login-utils/chsh.c @@ -70,8 +70,9 @@ struct sinfo { /* global due readline completion */ static char **global_shells; -static void __attribute__((__noreturn__)) usage (FILE *fp) +static void __attribute__((__noreturn__)) usage(void) { + FILE *fp = stdout; fputs(USAGE_HEADER, fp); fprintf(fp, _(" %s [options] [<username>]\n"), program_invocation_short_name); @@ -85,7 +86,7 @@ static void __attribute__((__noreturn__)) usage (FILE *fp) fputs(_(" -u, --help display this help and exit\n"), fp); fputs(_(" -v, --version output version information and exit\n"), fp); fprintf(fp, USAGE_MAN_TAIL("chsh(1)")); - exit(fp == stderr ? EXIT_FAILURE : EXIT_SUCCESS); + exit(EXIT_SUCCESS); } /* @@ -229,7 +230,7 @@ static void parse_argv(int argc, char **argv, struct sinfo *pinfo) exit(EXIT_SUCCESS); case 'u': /* deprecated */ case 'h': - usage(stdout); + usage(); case 'l': init_shells(); print_shells(); @@ -243,8 +244,9 @@ static void parse_argv(int argc, char **argv, struct sinfo *pinfo) } /* done parsing arguments. check for a username. */ if (optind < argc) { - if (optind + 1 < argc) - usage(stderr); + if (optind + 1 < argc) { + errx(EXIT_FAILURE, _("cannot handle multiple usernames")); + } pinfo->username = argv[optind]; } } |