diff options
author | Karel Zak | 2017-06-26 15:58:37 +0200 |
---|---|---|
committer | Karel Zak | 2017-06-26 15:58:37 +0200 |
commit | 47ccf06b4728130beb19b05a5c13a87e2807ad3e (patch) | |
tree | ca6073f0053d6e362b623d2817edcdb3ae45d93d /libsmartcols/samples/fromfile.c | |
parent | script: rename fixtty() to enable_rawmode_tty() (diff) | |
parent | misc: cosmetics, remove argument from usage(FILE*) (diff) | |
download | kernel-qcow2-util-linux-47ccf06b4728130beb19b05a5c13a87e2807ad3e.tar.gz kernel-qcow2-util-linux-47ccf06b4728130beb19b05a5c13a87e2807ad3e.tar.xz kernel-qcow2-util-linux-47ccf06b4728130beb19b05a5c13a87e2807ad3e.zip |
Merge branch 'usage-part2' of https://github.com/rudimeier/util-linux
* 'usage-part2' of https://github.com/rudimeier/util-linux:
misc: cosmetics, remove argument from usage(FILE*)
misc: cosmetics, remove argument from usage(int)
misc: never use usage(stderr)
misc: never use usage(ERROR)
misc: cleanup and fix --unknownopt issues
flock, getopt: write --help to stdout and return 0
tools: add checkusage.sh
Diffstat (limited to 'libsmartcols/samples/fromfile.c')
-rw-r--r-- | libsmartcols/samples/fromfile.c | 9 |
1 files changed, 5 insertions, 4 deletions
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] <column-data-file> ...\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); } } |