diff options
author | Ruediger Meier | 2017-06-21 20:23:09 +0200 |
---|---|---|
committer | Ruediger Meier | 2017-06-22 21:34:47 +0200 |
commit | 7a87a774afb156ede5d64ca00420d48a9a2248dc (patch) | |
tree | 45ff7e79e5cc5849a22fa0165d369c8f0ba3c84c /sys-utils/setarch.c | |
parent | dmesg: do not accept any non-option arguments (diff) | |
download | kernel-qcow2-util-linux-7a87a774afb156ede5d64ca00420d48a9a2248dc.tar.gz kernel-qcow2-util-linux-7a87a774afb156ede5d64ca00420d48a9a2248dc.tar.xz kernel-qcow2-util-linux-7a87a774afb156ede5d64ca00420d48a9a2248dc.zip |
setarch: use errtryhelp()
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'sys-utils/setarch.c')
-rw-r--r-- | sys-utils/setarch.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c index eb9cf21a0..b14dbea40 100644 --- a/sys-utils/setarch.c +++ b/sys-utils/setarch.c @@ -84,7 +84,7 @@ static int archwrapper; -static void __attribute__((__noreturn__)) show_help(void) +static void __attribute__((__noreturn__)) usage(void) { fputs(USAGE_HEADER, stdout); if (!archwrapper) @@ -121,17 +121,6 @@ static void __attribute__((__noreturn__)) show_help(void) exit(EXIT_SUCCESS); } -static void __attribute__((__noreturn__)) show_usage(const char *s) -{ - if (s) - errx(EXIT_FAILURE, - _("%s\nTry `%s --help' for more information."), s, - program_invocation_short_name); - else - errx(EXIT_FAILURE, _("Try `%s --help' for more information."), - program_invocation_short_name); -} - static void __attribute__((__noreturn__)) show_version(void) { @@ -301,9 +290,10 @@ int main(int argc, char *argv[]) textdomain(PACKAGE); atexit(close_stdout); - if (argc < 1) - show_usage(_("Not enough arguments")); - + if (argc < 1) { + warnx(_("Not enough arguments")); + errtryhelp(EXIT_FAILURE); + } archwrapper = strcmp(program_invocation_short_name, "setarch") != 0; if (archwrapper) arch = program_invocation_short_name; /* symlinks to setarch */ @@ -328,7 +318,7 @@ int main(int argc, char *argv[]) while ((c = getopt_long(argc, argv, "+hVv3BFILRSTXZ", longopts, NULL)) != -1) { switch (c) { case 'h': - show_help(); + usage(); break; case 'V': show_version(); |