diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-07-02 15:30:43 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-12 13:30:54 +0200 |
commit | bc196d19b7d2f0a5bc3218a577694724a653f010 (patch) | |
tree | eeb1034620e7bab8a45de4df42fb472bd8922e50 | |
parent | 15bd27b06c67e94541e3376d3d482f4f849f5aff (diff) | |
download | systemd-bc196d19b7d2f0a5bc3218a577694724a653f010.tar.gz |
coredumpctl: show --help text if "coredumpctl help" is called
Most of our programs that take "verbs" make the "help" verb either
equivalent to passing the --help switch (or at least print a message
redirecting the user to that switch). Do so in coredumpctl too, in order
to minimize surprises.
(cherry picked from commit 6d8be376e1682a79f0aecceb2136884c5b4327e2)
-rw-r--r-- | src/coredump/coredumpctl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c index cfe694cbdd..fbd4df04e6 100644 --- a/src/coredump/coredumpctl.c +++ b/src/coredump/coredumpctl.c @@ -150,7 +150,7 @@ static int acquire_journal(sd_journal **ret, char **matches) { return 0; } -static int help(void) { +static int verb_help(int argc, char **argv, void *userdata) { _cleanup_free_ char *link = NULL; int r; @@ -232,7 +232,7 @@ static int parse_argv(int argc, char *argv[]) { while ((c = getopt_long(argc, argv, "hA:o:F:1D:rS:U:qn:", options, NULL)) >= 0) switch(c) { case 'h': - return help(); + return verb_help(0, NULL, NULL); case ARG_VERSION: return version(); @@ -1207,6 +1207,7 @@ static int coredumpctl_main(int argc, char *argv[]) { { "dump", VERB_ANY, VERB_ANY, 0, dump_core }, { "debug", VERB_ANY, VERB_ANY, 0, run_debug }, { "gdb", VERB_ANY, VERB_ANY, 0, run_debug }, + { "help", VERB_ANY, 1, 0, verb_help }, {} }; |