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 /term-utils/setterm.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 'term-utils/setterm.c')
-rw-r--r-- | term-utils/setterm.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/term-utils/setterm.c b/term-utils/setterm.c index 9f60e5693..8ab5b45d7 100644 --- a/term-utils/setterm.c +++ b/term-utils/setterm.c @@ -371,8 +371,9 @@ static int parse_bfreq(char **av, char *oa, int *oi) return strtos32_or_err(arg, _("argument error")); } -static void __attribute__((__noreturn__)) usage(FILE *out) +static void __attribute__((__noreturn__)) usage(void) { + FILE *out = stdout; fputs(USAGE_HEADER, out); fprintf(out, _(" %s [options]\n"), program_invocation_short_name); @@ -420,7 +421,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out) fputs(_(" --version show version information and exit\n"), out); fputs(_(" --help display this help and exit\n"), out); fprintf(out, USAGE_MAN_TAIL("setterm(1)")); - exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); + exit(EXIT_SUCCESS); } static int __attribute__((__pure__)) set_opt_flag(int opt) @@ -672,7 +673,7 @@ static void parse_option(struct setterm_control *ctl, int ac, char **av) printf(UTIL_LINUX_VERSION); exit(EXIT_SUCCESS); case OPT_HELP: - usage(stdout); + usage(); default: errtryhelp(EXIT_FAILURE); } @@ -1170,9 +1171,10 @@ int main(int argc, char **argv) textdomain(PACKAGE); atexit(close_stdout); - if (argc < 2) - usage(stderr); - + if (argc < 2) { + warnx(_("bad usage")); + errtryhelp(EXIT_FAILURE); + } parse_option(&ctl, argc, argv); init_terminal(&ctl); perform_sequence(&ctl); |