From 6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Mon, 19 Jun 2017 20:52:50 +0200 Subject: misc: never use usage(stderr) Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier --- libsmartcols/samples/fromfile.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'libsmartcols') diff --git a/libsmartcols/samples/fromfile.c b/libsmartcols/samples/fromfile.c index 674f01206..de0a8eac4 100644 --- a/libsmartcols/samples/fromfile.c +++ b/libsmartcols/samples/fromfile.c @@ -194,8 +194,9 @@ static void compose_tree(struct libscols_table *tb, int parent_col, int id_col) } -static void __attribute__ ((__noreturn__)) usage(FILE * out) +static void __attribute__((__noreturn__)) usage(void) { + FILE *out = stdout; fprintf(out, "\n %s [options] ...\n\n", program_invocation_short_name); @@ -212,7 +213,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out) fputs(" -h, --help this help\n", out); fputs("\n", out); - exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); + exit(EXIT_SUCCESS); } int main(int argc, char *argv[]) @@ -298,9 +299,9 @@ int main(int argc, char *argv[]) scols_table_set_termwidth(tb, strtou32_or_err(optarg, "failed to parse terminal width")); break; case 'h': - usage(stdout); + usage(); default: - usage(stderr); + errtryhelp(EXIT_FAILURE); } } -- cgit v1.2.3-55-g7522