]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/coredump/coredumpctl.c
tree-wide: add clickable man page link to all --help texts
[thirdparty/systemd.git] / src / coredump / coredumpctl.c
index e255206228aafee9d3b9f0007d0bdd24127acd3f..78e279db8bc7fbab43cc9c785700813b34121608 100644 (file)
@@ -1,9 +1,4 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
-/***
-  This file is part of systemd.
-
-  Copyright 2012 Zbigniew JÄ™drzejewski-Szmek
-***/
 
 #include <fcntl.h>
 #include <getopt.h>
@@ -140,6 +135,13 @@ static int acquire_journal(sd_journal **ret, char **matches) {
 }
 
 static int help(void) {
+        _cleanup_free_ char *link = NULL;
+        int r;
+
+        r = terminal_urlify_man("coredumpctl", "1", &link);
+        if (r < 0)
+                return log_oom();
+
         printf("%s [OPTIONS...]\n\n"
                "List or retrieve coredumps from the journal.\n\n"
                "Flags:\n"
@@ -161,7 +163,10 @@ static int help(void) {
                "  info [MATCHES...]  Show detailed information about one or more coredumps\n"
                "  dump [MATCHES...]  Print first matching coredump to stdout\n"
                "  debug [MATCHES...] Start a debugger for the first matching coredump\n"
-               , program_invocation_short_name);
+               "\nSee the %s for details.\n"
+               , program_invocation_short_name
+               , link
+        );
 
         return 0;
 }
@@ -217,7 +222,7 @@ static int parse_argv(int argc, char *argv[]) {
 
                 case 'o':
                         if (arg_output) {
-                                log_error("cannot set output more than once");
+                                log_error("Cannot set output more than once.");
                                 return -EINVAL;
                         }
 
@@ -241,7 +246,7 @@ static int parse_argv(int argc, char *argv[]) {
 
                 case 'F':
                         if (arg_field) {
-                                log_error("cannot use --field/-F more than once");
+                                log_error("Cannot use --field/-F more than once.");
                                 return -EINVAL;
                         }
                         arg_field = optarg;
@@ -659,7 +664,8 @@ static int dump_list(int argc, char **argv, void *userdata) {
          * pick a fairly low data threshold here */
         sd_journal_set_data_threshold(j, 4096);
 
-        if (arg_one) {
+        /* "info" without pattern implies "-1" */
+        if (arg_one || (verb_is_info && argc == 1)) {
                 r = focus(j);
                 if (r < 0)
                         return r;