summaryrefslogtreecommitdiffstats
path: root/schedutils
diff options
context:
space:
mode:
authorKarel Zak2016-12-19 13:13:34 +0100
committerKarel Zak2016-12-19 13:13:34 +0100
commit677ec86cef983a106c6e5d175f44b125858c3016 (patch)
treeb993641faa65700acd62768da189a103da4c40ec /schedutils
parentinclude/c.h: add errtryhelp() (diff)
downloadkernel-qcow2-util-linux-677ec86cef983a106c6e5d175f44b125858c3016.tar.gz
kernel-qcow2-util-linux-677ec86cef983a106c6e5d175f44b125858c3016.tar.xz
kernel-qcow2-util-linux-677ec86cef983a106c6e5d175f44b125858c3016.zip
Use --help suggestion on invalid option
The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'schedutils')
-rw-r--r--schedutils/chrt.c7
-rw-r--r--schedutils/ionice.c2
-rw-r--r--schedutils/taskset.c3
3 files changed, 4 insertions, 8 deletions
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index 73d1ffa9b..b52aec137 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -439,8 +439,6 @@ int main(int argc, char **argv)
while((c = getopt_long(argc, argv, "+abdD:fiphmoP:T:rRvV", longopts, NULL)) != -1)
{
- int ret = EXIT_FAILURE;
-
switch (c) {
case 'a':
ctl->all_tasks = 1;
@@ -496,10 +494,9 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
- ret = EXIT_SUCCESS;
- /* fallthrough */
+ show_usage(EXIT_SUCCESS);
default:
- show_usage(ret);
+ errtryhelp(EXIT_FAILURE);
}
}
diff --git a/schedutils/ionice.c b/schedutils/ionice.c
index 5528afed5..38a6846f9 100644
--- a/schedutils/ionice.c
+++ b/schedutils/ionice.c
@@ -203,7 +203,7 @@ int main(int argc, char **argv)
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
switch (ioclass) {
diff --git a/schedutils/taskset.c b/schedutils/taskset.c
index d6b21e45c..199d62566 100644
--- a/schedutils/taskset.c
+++ b/schedutils/taskset.c
@@ -172,8 +172,7 @@ int main(int argc, char **argv)
usage(stdout);
break;
default:
- usage(stderr);
- break;
+ errtryhelp(EXIT_FAILURE);
}
}