]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coredumpctl: show --help text if "coredumpctl help" is called
authorLennart Poettering <lennart@poettering.net>
Fri, 2 Jul 2021 13:30:43 +0000 (15:30 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 2 Jul 2021 16:28:06 +0000 (18:28 +0200)
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.

src/coredump/coredumpctl.c

index 9a577d47c8b7227120fea466b50bab436385ad78..def3650bb4588107bba8aea3912660f473dac955 100644 (file)
@@ -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();
@@ -1242,6 +1242,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 },
                 {}
         };