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 /text-utils | |
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 'text-utils')
-rw-r--r-- | text-utils/col.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/text-utils/col.c b/text-utils/col.c index bac48e7e3..a473e55fb 100644 --- a/text-utils/col.c +++ b/text-utils/col.c @@ -124,8 +124,9 @@ static int pass_unknown_seqs; /* whether to pass unknown control sequences */ if (putwchar(ch) == WEOF) \ wrerr(); -static void __attribute__((__noreturn__)) usage(FILE *out) +static void __attribute__((__noreturn__)) usage(void) { + FILE *out = stdout; fprintf(out, _( "\nUsage:\n" " %s [options]\n"), program_invocation_short_name); @@ -149,7 +150,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out) program_invocation_short_name); fprintf(out, USAGE_MAN_TAIL("col(1)")); - exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); + exit(EXIT_SUCCESS); } static void __attribute__((__noreturn__)) wrerr(void) @@ -221,13 +222,15 @@ int main(int argc, char **argv) printf(UTIL_LINUX_VERSION); return EXIT_SUCCESS; case 'H': - usage(stdout); + usage(); default: errtryhelp(EXIT_FAILURE); } - if (optind != argc) - usage(stderr); + if (optind != argc) { + warnx(_("bad usage")); + errtryhelp(EXIT_FAILURE); + } adjust = cur_col = extra_lines = warned = 0; cur_line = max_line = nflushd_lines = this_line = 0; |