summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-08-09 10:32:31 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-08-20 11:33:04 +0200
commit37ec0fdd3443a77a5120cf55002fedcb5b1dd069 (patch)
tree75c684fd19b60094f5a89220c728f5e12e4c34b8 /src
parentutil: improve comments why we ignore EACCES and EPERM (diff)
downloadsystemd-37ec0fdd3443a77a5120cf55002fedcb5b1dd069.tar.xz
systemd-37ec0fdd3443a77a5120cf55002fedcb5b1dd069.zip
tree-wide: add clickable man page link to all --help texts
This is a bit like the info link in most of GNU's --help texts, but we don't do info but man pages, and we make them properly clickable on terminal supporting that, because awesome. I think it's generally advisable to link up our (brief) --help texts and our (more comprehensive) man pages a bit, so this should be an easy and straight-forward way to do it.
Diffstat (limited to 'src')
-rw-r--r--src/activate/activate.c23
-rw-r--r--src/analyze/analyze.c14
-rw-r--r--src/ask-password/ask-password.c25
-rw-r--r--src/basic/terminal-util.c9
-rw-r--r--src/basic/terminal-util.h1
-rw-r--r--src/binfmt/binfmt.c21
-rw-r--r--src/boot/bootctl.c19
-rw-r--r--src/busctl/busctl.c12
-rw-r--r--src/cgls/cgls.c20
-rw-r--r--src/cgtop/cgtop.c20
-rw-r--r--src/core/main.c15
-rw-r--r--src/coredump/coredumpctl.c12
-rw-r--r--src/cryptsetup/cryptsetup.c16
-rw-r--r--src/delta/delta.c19
-rw-r--r--src/detect-virt/detect-virt.c21
-rw-r--r--src/escape/escape.c20
-rw-r--r--src/firstboot/firstboot.c19
-rw-r--r--src/hostname/hostnamectl.c12
-rw-r--r--src/hwdb/hwdb.c24
-rw-r--r--src/journal-remote/journal-gatewayd.c22
-rw-r--r--src/journal-remote/journal-remote-main.c27
-rw-r--r--src/journal-remote/journal-upload.c20
-rw-r--r--src/journal/cat.c18
-rw-r--r--src/journal/journalctl.c18
-rw-r--r--src/locale/localectl.c13
-rw-r--r--src/login/inhibit.c20
-rw-r--r--src/login/loginctl.c16
-rw-r--r--src/machine-id-setup/machine-id-setup-main.c21
-rw-r--r--src/machine/machinectl.c12
-rw-r--r--src/modules-load/modules-load.c22
-rw-r--r--src/mount/mount-tool.c23
-rw-r--r--src/network/networkctl.c19
-rw-r--r--src/network/wait-online/wait-online.c17
-rw-r--r--src/notify/notify.c22
-rw-r--r--src/nspawn/nspawn.c19
-rw-r--r--src/partition/growfs.c23
-rw-r--r--src/path/path.c22
-rw-r--r--src/portable/portablectl.c14
-rw-r--r--src/resolve/resolvconf-compat.c20
-rw-r--r--src/resolve/resolvectl.c41
-rw-r--r--src/run/run.c19
-rw-r--r--src/sleep/sleep.c34
-rw-r--r--src/socket-proxy/socket-proxyd.c30
-rw-r--r--src/sysctl/sysctl.c19
-rw-r--r--src/systemctl/systemctl.c113
-rw-r--r--src/sysusers/sysusers.c19
-rw-r--r--src/timedate/timedatectl.c12
-rw-r--r--src/tmpfiles/tmpfiles.c19
-rw-r--r--src/tty-ask-password-agent/tty-ask-password-agent.c21
-rw-r--r--src/udev/udevadm.c13
-rw-r--r--src/udev/udevd.c19
-rw-r--r--src/veritysetup/veritysetup.c17
52 files changed, 854 insertions, 232 deletions
diff --git a/src/activate/activate.c b/src/activate/activate.c
index 45386a38f4..25e2ec5aa7 100644
--- a/src/activate/activate.c
+++ b/src/activate/activate.c
@@ -19,6 +19,7 @@
#include "socket-util.h"
#include "string-util.h"
#include "strv.h"
+#include "terminal-util.h"
static char** arg_listen = NULL;
static bool arg_accept = false;
@@ -310,7 +311,14 @@ static int install_chld_handler(void) {
return 0;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-socket-activate", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...]\n\n"
"Listen on sockets and launch child on connection.\n\n"
"Options:\n"
@@ -323,9 +331,13 @@ static void help(void) {
" -E --setenv=NAME[=VALUE] Pass an environment variable to children\n"
" --fdname=NAME[:NAME...] Specify names for file descriptors\n"
" --inetd Enable inetd file descriptor passing protocol\n"
- "\n"
- "Note: file descriptors from sd_listen_fds() will be passed through.\n"
- , program_invocation_short_name);
+ "\nNote: file descriptors from sd_listen_fds() will be passed through.\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -358,8 +370,7 @@ static int parse_argv(int argc, char *argv[]) {
while ((c = getopt_long(argc, argv, "+hl:aE:d", options, NULL)) >= 0)
switch(c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 6ecaca0163..7695540599 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -1724,9 +1724,15 @@ static int do_verify(int argc, char *argv[], void *userdata) {
}
static int help(int argc, char *argv[], void *userdata) {
+ _cleanup_free_ char *link = NULL;
+ int r;
(void) pager_open(arg_no_pager, false);
+ r = terminal_urlify_man("systemd-analyze", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
"Profile systemd, show unit dependencies, check unit files.\n\n"
" -h --help Show this help\n"
@@ -1760,10 +1766,12 @@ static int help(int argc, char *argv[], void *userdata) {
" verify FILE... Check unit files for correctness\n"
" calendar SPEC... Validate repetitive calendar time events\n"
" service-watchdogs [BOOL] Get/set service watchdog state\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
- /* When updating this list, including descriptions, apply
- * changes to shell-completion/bash/systemd-analyze and
+ /* When updating this list, including descriptions, apply changes to shell-completion/bash/systemd-analyze and
* shell-completion/zsh/_systemd-analyze too. */
return 0;
diff --git a/src/ask-password/ask-password.c b/src/ask-password/ask-password.c
index 8e1d834ab4..fe2f871440 100644
--- a/src/ask-password/ask-password.c
+++ b/src/ask-password/ask-password.c
@@ -10,6 +10,7 @@
#include "log.h"
#include "macro.h"
#include "strv.h"
+#include "terminal-util.h"
static const char *arg_icon = NULL;
static const char *arg_id = NULL;
@@ -20,7 +21,14 @@ static bool arg_multiple = false;
static bool arg_no_output = false;
static AskPasswordFlags arg_flags = ASK_PASSWORD_PUSH_CACHE;
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-ask-password", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] MESSAGE\n\n"
"Query the user for a system passphrase, via the TTY or an UI agent.\n\n"
" -h --help Show this help\n"
@@ -33,7 +41,12 @@ static void help(void) {
" --accept-cached Accept cached passwords\n"
" --multiple List multiple passwords if available\n"
" --no-output Do not print password to standard output\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -48,10 +61,12 @@ static int parse_argv(int argc, char *argv[]) {
ARG_ID,
ARG_KEYNAME,
ARG_NO_OUTPUT,
+ ARG_VERSION,
};
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, ARG_VERSION },
{ "icon", required_argument, NULL, ARG_ICON },
{ "timeout", required_argument, NULL, ARG_TIMEOUT },
{ "echo", no_argument, NULL, ARG_ECHO },
@@ -74,8 +89,10 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
+
+ case ARG_VERSION:
+ return version();
case ARG_ICON:
arg_icon = optarg;
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
index f4af0e6522..a667154270 100644
--- a/src/basic/terminal-util.c
+++ b/src/basic/terminal-util.c
@@ -1369,6 +1369,15 @@ int terminal_urlify_path(const char *path, const char *text, char **ret) {
return terminal_urlify(url, text, ret);
}
+int terminal_urlify_man(const char *page, const char *section, char **ret) {
+ const char *url, *text;
+
+ url = strjoina("man:", page, "(", section, ")");
+ text = strjoina(page, "(", section, ") man page");
+
+ return terminal_urlify(url, text, ret);
+}
+
static int cat_file(const char *filename, bool newline) {
_cleanup_fclose_ FILE *f = NULL;
_cleanup_free_ char *urlified = NULL;
diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h
index 38c382c47c..436951be98 100644
--- a/src/basic/terminal-util.h
+++ b/src/basic/terminal-util.h
@@ -157,6 +157,7 @@ int vt_reset_keyboard(int fd);
int terminal_urlify(const char *url, const char *text, char **ret);
int terminal_urlify_path(const char *path, const char *text, char **ret);
+int terminal_urlify_man(const char *page, const char *section, char **ret);
typedef enum CatFlags {
CAT_FLAGS_MAIN_FILE_OPTIONAL = 1 << 0,
diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
index 697e16c53a..55f700c089 100644
--- a/src/binfmt/binfmt.c
+++ b/src/binfmt/binfmt.c
@@ -95,14 +95,26 @@ static int apply_file(const char *path, bool ignore_enoent) {
return r;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-binfmt.service", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [CONFIGURATION FILE...]\n\n"
- "Registers binary formats.\n\n"
+ "Registers binary formats with the kernel.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
" --cat-config Show configuration files\n"
" --no-pager Do not pipe output into a pager\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -131,8 +143,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c
index b74129a5f0..8680b3a6ae 100644
--- a/src/boot/bootctl.c
+++ b/src/boot/bootctl.c
@@ -826,23 +826,30 @@ static int install_loader_config(const char *esp_path) {
}
static int help(int argc, char *argv[], void *userdata) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("bootctl", "1", &link);
+ if (r < 0)
+ return log_oom();
- printf("%s [COMMAND] [OPTIONS...]\n"
- "\n"
+ printf("%s [COMMAND] [OPTIONS...]\n\n"
"Install, update or remove the systemd-boot EFI boot manager.\n\n"
" -h --help Show this help\n"
" --version Print version\n"
" --path=PATH Path to the EFI System Partition (ESP)\n"
" -p --print-path Print path to the EFI partition\n"
" --no-variables Don't touch EFI variables\n"
- "\n"
- "Commands:\n"
+ "\nCommands:\n"
" status Show status of installed systemd-boot and EFI variables\n"
" list List boot entries\n"
" install Install systemd-boot to the ESP and EFI variables\n"
" update Update systemd-boot in the ESP and EFI variables\n"
- " remove Remove systemd-boot from the ESP and EFI variables\n",
- program_invocation_short_name);
+ " remove Remove systemd-boot from the ESP and EFI variables\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
return 0;
}
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c
index 69aae726b3..9dc522ad18 100644
--- a/src/busctl/busctl.c
+++ b/src/busctl/busctl.c
@@ -1726,6 +1726,13 @@ static int set_property(int argc, char **argv, void *userdata) {
}
static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("busctl", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
"Introspect the bus.\n\n"
" -h --help Show this help\n"
@@ -1768,7 +1775,10 @@ static int help(void) {
" set-property SERVICE OBJECT INTERFACE PROPERTY SIGNATURE ARGUMENT...\n"
" Set property value\n"
" help Show this help\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
return 0;
}
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c
index 9c2f591dc6..58d72b51a2 100644
--- a/src/cgls/cgls.c
+++ b/src/cgls/cgls.c
@@ -18,6 +18,7 @@
#include "pager.h"
#include "path-util.h"
#include "strv.h"
+#include "terminal-util.h"
#include "unit-name.h"
#include "util.h"
@@ -35,7 +36,14 @@ static char **arg_names = NULL;
static int arg_full = -1;
static char* arg_machine = NULL;
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-cgls", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [CGROUP...]\n\n"
"Recursively show control group contents.\n\n"
" -h --help Show this help\n"
@@ -47,7 +55,12 @@ static void help(void) {
" -l --full Do not ellipsize output\n"
" -k Include kernel threads in output\n"
" -M --machine= Show container\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -80,8 +93,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index 8dda08ab4c..cd338cbb31 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -709,7 +709,14 @@ static void display(Hashmap *a) {
}
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-cgtop", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [CGROUP]\n\n"
"Show top control groups by their resource usage.\n\n"
" -h --help Show this help\n"
@@ -731,7 +738,13 @@ static void help(void) {
" -b --batch Run in batch mode, accepting no input\n"
" --depth=DEPTH Maximum traversal depth (default: %u)\n"
" -M --machine= Show container\n"
- , program_invocation_short_name, arg_depth);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , arg_depth
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -769,8 +782,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/core/main.c b/src/core/main.c
index c8788b8e8a..078decb432 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1066,6 +1066,12 @@ static int parse_argv(int argc, char *argv[]) {
}
static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd", "1", &link);
+ if (r < 0)
+ return log_oom();
printf("%s [OPTIONS...]\n\n"
"Starts up and maintains the system or user services.\n\n"
@@ -1089,8 +1095,11 @@ static int help(void) {
" --log-color[=BOOL] Highlight important log messages\n"
" --log-location[=BOOL] Include code location in log messages\n"
" --default-standard-output= Set default standard output for services\n"
- " --default-standard-error= Set default standard error output for services\n",
- program_invocation_short_name);
+ " --default-standard-error= Set default standard error output for services\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
return 0;
}
@@ -2314,7 +2323,7 @@ int main(int argc, char *argv[]) {
skip_setup = true;
if (arg_action == ACTION_HELP) {
- retval = help();
+ retval = help() < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
goto finish;
} else if (arg_action == ACTION_VERSION) {
retval = version();
diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c
index e7ba8d3664..78e279db8b 100644
--- a/src/coredump/coredumpctl.c
+++ b/src/coredump/coredumpctl.c
@@ -135,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"
@@ -156,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;
}
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 832168184a..4d8fb09f1d 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -19,6 +19,7 @@
#include "path-util.h"
#include "string-util.h"
#include "strv.h"
+#include "terminal-util.h"
#include "util.h"
/* internal helper */
@@ -549,12 +550,21 @@ static int attach_luks_or_plain(struct crypt_device *cd,
}
static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-cryptsetup@.service", "8", &link);
+ if (r < 0)
+ return log_oom();
printf("%s attach VOLUME SOURCEDEVICE [PASSWORD] [OPTIONS]\n"
"%s detach VOLUME\n\n"
- "Attaches or detaches an encrypted block device.\n",
- program_invocation_short_name,
- program_invocation_short_name);
+ "Attaches or detaches an encrypted block device.\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , program_invocation_short_name
+ , link
+ );
return 0;
}
diff --git a/src/delta/delta.c b/src/delta/delta.c
index 21cce7e8b5..0cda1df2a3 100644
--- a/src/delta/delta.c
+++ b/src/delta/delta.c
@@ -515,7 +515,14 @@ static int process_suffix_chop(const char *arg) {
return -EINVAL;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-delta", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [SUFFIX...]\n\n"
"Find overridden configuration files.\n\n"
" -h --help Show this help\n"
@@ -523,7 +530,12 @@ static void help(void) {
" --no-pager Do not pipe output into a pager\n"
" --diff[=1|0] Show a diff when overridden files differ\n"
" -t --type=LIST... Only display a selected set of override types\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_flags(const char *flag_str, int flags) {
@@ -578,8 +590,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/detect-virt/detect-virt.c b/src/detect-virt/detect-virt.c
index e8c6362a9c..b98ddbd0c6 100644
--- a/src/detect-virt/detect-virt.c
+++ b/src/detect-virt/detect-virt.c
@@ -5,7 +5,9 @@
#include <stdbool.h>
#include <stdlib.h>
+#include "alloc-util.h"
#include "string-table.h"
+#include "terminal-util.h"
#include "util.h"
#include "virt.h"
@@ -18,7 +20,14 @@ static enum {
ONLY_PRIVATE_USERS,
} arg_mode = ANY_VIRTUALIZATION;
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-detect-virt", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...]\n\n"
"Detect execution in a virtualized environment.\n\n"
" -h --help Show this help\n"
@@ -29,7 +38,12 @@ static void help(void) {
" --private-users Only detect whether we are running in a user namespace\n"
" -q --quiet Don't output anything, just set return value\n"
" --list List all known and detectable types of virtualization\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -62,8 +76,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/escape/escape.c b/src/escape/escape.c
index cd99ca62f4..c5cb7897a9 100644
--- a/src/escape/escape.c
+++ b/src/escape/escape.c
@@ -8,6 +8,7 @@
#include "log.h"
#include "string-util.h"
#include "strv.h"
+#include "terminal-util.h"
#include "unit-name.h"
static enum {
@@ -20,7 +21,14 @@ static const char *arg_template = NULL;
static bool arg_path = false;
static bool arg_instance = false;
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-escape", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [NAME...]\n\n"
"Escape strings for usage in systemd unit names.\n\n"
" -h --help Show this help\n"
@@ -31,7 +39,12 @@ static void help(void) {
" -u --unescape Unescape strings\n"
" -m --mangle Mangle strings\n"
" -p --path When escaping/unescaping assume the string is a path\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -64,8 +77,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
index 825b67e87e..552e10d157 100644
--- a/src/firstboot/firstboot.c
+++ b/src/firstboot/firstboot.c
@@ -674,7 +674,14 @@ static int process_root_password(void) {
return 0;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-firstboot", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...]\n\n"
"Configures basic settings of the system.\n\n"
" -h --help Show this help\n"
@@ -700,7 +707,12 @@ static void help(void) {
" --copy-root-password Copy root password from host\n"
" --copy Copy locale, keymap, timezone, root password\n"
" --setup-machine-id Generate a new random machine ID\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -767,8 +779,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index fa4292c1fc..be94de4994 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -301,6 +301,13 @@ static int set_location(int argc, char **argv, void *userdata) {
}
static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("hostnamectl", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] COMMAND ...\n\n"
"Query or change system hostname.\n\n"
" -h --help Show this help\n"
@@ -318,7 +325,10 @@ static int help(void) {
" set-chassis NAME Set chassis type for host\n"
" set-deployment NAME Set deployment environment for host\n"
" set-location NAME Set location for host\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
return 0;
}
diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c
index 317cad8a67..8a99510619 100644
--- a/src/hwdb/hwdb.c
+++ b/src/hwdb/hwdb.c
@@ -19,6 +19,7 @@
#include "strbuf.h"
#include "string-util.h"
#include "strv.h"
+#include "terminal-util.h"
#include "util.h"
#include "verbs.h"
@@ -686,8 +687,15 @@ static int hwdb_update(int argc, char *argv[], void *userdata) {
return r;
}
-static void help(void) {
- printf("Usage: %s OPTIONS COMMAND\n\n"
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-hwdb", "8", &link);
+ if (r < 0)
+ return log_oom();
+
+ printf("%s OPTIONS COMMAND\n\n"
"Update or query the hardware database.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
@@ -696,8 +704,13 @@ static void help(void) {
" -r --root=PATH Alternative root path in the filesystem\n\n"
"Commands:\n"
" update Update the hwdb database\n"
- " query MODALIAS Query database and print result\n",
- program_invocation_short_name);
+ " query MODALIAS Query database and print result\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -724,8 +737,7 @@ static int parse_argv(int argc, char *argv[]) {
switch(c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c
index 9e77e314ff..88e65ed905 100644
--- a/src/journal-remote/journal-gatewayd.c
+++ b/src/journal-remote/journal-gatewayd.c
@@ -22,6 +22,7 @@
#include "os-util.h"
#include "parse-util.h"
#include "sigbus.h"
+#include "terminal-util.h"
#include "util.h"
#define JOURNAL_WAIT_TIMEOUT (10*USEC_PER_SEC)
@@ -859,7 +860,14 @@ static int request_handler(
return mhd_respond(connection, MHD_HTTP_NOT_FOUND, "Not found.");
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-journal-gatewayd.service", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] ...\n\n"
"HTTP server for journal events.\n\n"
" -h --help Show this help\n"
@@ -867,8 +875,13 @@ static void help(void) {
" --cert=CERT.PEM Server certificate in PEM format\n"
" --key=KEY.PEM Server key in PEM format\n"
" --trust=CERT.PEM Certificate authority certificate in PEM format\n"
- " -D --directory=PATH Serve journal files in directory\n",
- program_invocation_short_name);
+ " -D --directory=PATH Serve journal files in directory\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -899,8 +912,7 @@ static int parse_argv(int argc, char *argv[]) {
switch(c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c
index 8fda9d1499..6d9b44e515 100644
--- a/src/journal-remote/journal-remote-main.c
+++ b/src/journal-remote/journal-remote-main.c
@@ -17,6 +17,7 @@
#include "stat-util.h"
#include "string-table.h"
#include "strv.h"
+#include "terminal-util.h"
#define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem"
#define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem"
@@ -727,7 +728,8 @@ static int parse_config(void) {
{ "Remote", "ServerKeyFile", config_parse_path, 0, &arg_key },
{ "Remote", "ServerCertificateFile", config_parse_path, 0, &arg_cert },
{ "Remote", "TrustedCertificateFile", config_parse_path, 0, &arg_trust },
- {}};
+ {}
+ };
return config_parse_many_nulstr(PKGSYSCONFDIR "/journal-remote.conf",
CONF_PATHS_NULSTR("systemd/journal-remote.conf.d"),
@@ -735,7 +737,14 @@ static int parse_config(void) {
CONFIG_PARSE_WARN, NULL);
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-journal-remote.service", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] {FILE|-}...\n\n"
"Write external journal events to journal file(s).\n\n"
" -h --help Show this help\n"
@@ -757,9 +766,13 @@ static void help(void) {
" --gnutls-log=CATEGORY...\n"
" Specify a list of gnutls logging categories\n"
" --split-mode=none|host How many output files to create\n"
- "\n"
- "Note: file descriptors from sd_listen_fds() will be consumed, too.\n"
- , program_invocation_short_name);
+ "\nNote: file descriptors from sd_listen_fds() will be consumed, too.\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -806,9 +819,9 @@ static int parse_argv(int argc, char *argv[]) {
while ((c = getopt_long(argc, argv, "ho:", options, NULL)) >= 0)
switch(c) {
+
case 'h':
- help();
- return 0 /* done */;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c
index 209e5011d9..5e17d36393 100644
--- a/src/journal-remote/journal-upload.c
+++ b/src/journal-remote/journal-upload.c
@@ -23,6 +23,7 @@
#include "sigbus.h"
#include "signal-util.h"
#include "string-util.h"
+#include "terminal-util.h"
#include "util.h"
#define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-upload.pem"
@@ -526,7 +527,14 @@ static int parse_config(void) {
CONFIG_PARSE_WARN, NULL);
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-journal-upload.service", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s -u URL {FILE|-}...\n\n"
"Upload journal events to a remote server.\n\n"
" -h --help Show this help\n"
@@ -550,7 +558,12 @@ static void help(void) {
" --follow[=BOOL] Do [not] wait for input\n"
" --save-state[=FILE] Save uploaded cursors (default \n"
" " STATE_FILE ")\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -598,8 +611,7 @@ static int parse_argv(int argc, char *argv[]) {
while ((c = getopt_long(argc, argv, "hu:mM:D:", options, NULL)) >= 0)
switch(c) {
case 'h':
- help();
- return 0 /* done */;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/journal/cat.c b/src/journal/cat.c
index 8a11c8c3d1..8cc4580d0b 100644
--- a/src/journal/cat.c
+++ b/src/journal/cat.c
@@ -9,17 +9,26 @@
#include "sd-journal.h"
+#include "alloc-util.h"
#include "fd-util.h"
#include "parse-util.h"
#include "string-util.h"
#include "syslog-util.h"
#include "util.h"
+#include "terminal-util.h"
static const char *arg_identifier = NULL;
static int arg_priority = LOG_INFO;
static bool arg_level_prefix = true;
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-cat", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
"Execute process with stdout/stderr connected to the journal.\n\n"
" -h --help Show this help\n"
@@ -27,7 +36,12 @@ static void help(void) {
" -t --identifier=STRING Set syslog identifier\n"
" -p --priority=PRIORITY Set priority value (0..7)\n"
" --level-prefix=BOOL Control whether level prefix shall be parsed\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 799510504b..be37b879fa 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -297,10 +297,16 @@ static int parse_boot_descriptor(const char *x, sd_id128_t *boot_id, int *offset
return 0;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
(void) pager_open(arg_no_pager, arg_pager_end);
+ r = terminal_urlify_man("journalctl", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [MATCHES...]\n\n"
"Query the journal.\n\n"
"Options:\n"
@@ -364,7 +370,12 @@ static void help(void) {
" --update-catalog Update the message catalog database\n"
" --new-id128 Generate a new 128-bit ID\n"
" --setup-keys Generate a new FSS key pair\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -478,8 +489,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index ebc6a8ca8a..88fd077e09 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -19,6 +19,7 @@
#include "set.h"
#include "spawn-polkit-agent.h"
#include "strv.h"
+#include "terminal-util.h"
#include "util.h"
#include "verbs.h"
#include "virt.h"
@@ -373,6 +374,13 @@ static int list_x11_keymaps(int argc, char **argv, void *userdata) {
}
static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("localectl", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] COMMAND ...\n\n"
"Query or change system locale and keyboard settings.\n\n"
" -h --help Show this help\n"
@@ -395,7 +403,10 @@ static int help(void) {
" list-x11-keymap-variants [LAYOUT]\n"
" Show known X11 keyboard mapping variants\n"
" list-x11-keymap-options Show known X11 keyboard mapping options\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
return 0;
}
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index b0bb8de57e..1daaa8b450 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -17,6 +17,7 @@
#include "process-util.h"
#include "signal-util.h"
#include "strv.h"
+#include "terminal-util.h"
#include "user-util.h"
#include "util.h"
@@ -115,7 +116,14 @@ static int print_inhibitors(sd_bus *bus, sd_bus_error *error) {
return 0;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-inhibit", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
"Execute a process while inhibiting shutdown/sleep/idle.\n\n"
" -h --help Show this help\n"
@@ -129,7 +137,12 @@ static void help(void) {
" --why=STRING A descriptive string why is being inhibited\n"
" --mode=MODE One of block or delay\n"
" --list List active inhibitors\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -166,8 +179,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index 9b3fed928b..9faeecbddd 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -1288,6 +1288,14 @@ static int terminate_seat(int argc, char *argv[], void *userdata) {
}
static int help(int argc, char *argv[], void *userdata) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ (void) pager_open(arg_no_pager, false);
+
+ r = terminal_urlify_man("loginctl", "1", &link);
+ if (r < 0)
+ return log_oom();
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
"Send control commands to or query the login manager.\n\n"
@@ -1335,7 +1343,10 @@ static int help(int argc, char *argv[], void *userdata) {
" attach NAME DEVICE... Attach one or more devices to a seat\n"
" flush-devices Flush all device associations\n"
" terminate-seat NAME... Terminate all sessions on one or more seats\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
return 0;
}
@@ -1380,8 +1391,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help(0, NULL, NULL);
- return 0;
+ return help(0, NULL, NULL);
case ARG_VERSION:
return version();
diff --git a/src/machine-id-setup/machine-id-setup-main.c b/src/machine-id-setup/machine-id-setup-main.c
index 966fd8e404..ed2a843730 100644
--- a/src/machine-id-setup/machine-id-setup-main.c
+++ b/src/machine-id-setup/machine-id-setup-main.c
@@ -5,17 +5,26 @@
#include <stdio.h>
#include <stdlib.h>
+#include "alloc-util.h"
#include "id128-util.h"
#include "log.h"
#include "machine-id-setup.h"
#include "path-util.h"
+#include "terminal-util.h"
#include "util.h"
static char *arg_root = NULL;
static bool arg_commit = false;
static bool arg_print = false;
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-machine-id-setup", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...]\n\n"
"Initialize /etc/machine-id from a random source.\n\n"
" -h --help Show this help\n"
@@ -23,7 +32,12 @@ static void help(void) {
" --root=ROOT Filesystem root\n"
" --commit Commit transient ID\n"
" --print Print used machine ID\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -54,8 +68,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index f083dd2f81..83787015d2 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -2609,8 +2609,15 @@ static int clean_images(int argc, char *argv[], void *userdata) {
}
static int help(int argc, char *argv[], void *userdata) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
(void) pager_open(arg_no_pager, false);
+ r = terminal_urlify_man("machinectl", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
"Send control commands to or query the virtual machine and container\n"
"registration manager.\n\n"
@@ -2679,7 +2686,10 @@ static int help(int argc, char *argv[], void *userdata) {
" export-raw NAME [FILE] Export a RAW container or VM image locally\n"
" list-transfers Show list of downloads in progress\n"
" cancel-transfer Cancel a download\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
return 0;
}
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
index 4b0b9f4c80..bd4513b823 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -16,6 +16,7 @@
#include "proc-cmdline.h"
#include "string-util.h"
#include "strv.h"
+#include "terminal-util.h"
#include "util.h"
static char **arg_proc_cmdline_modules = NULL;
@@ -100,12 +101,24 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent
return r;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-modules-load.service", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [CONFIGURATION FILE...]\n\n"
"Loads statically configured kernel modules.\n\n"
" -h --help Show this help\n"
- " --version Show package version\n",
- program_invocation_short_name);
+ " --version Show package version\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -130,8 +143,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c
index 64c1efdb1c..2e88e40646 100644
--- a/src/mount/mount-tool.c
+++ b/src/mount/mount-tool.c
@@ -58,7 +58,14 @@ static gid_t arg_gid = GID_INVALID;
static bool arg_fsck = true;
static bool arg_aggressive_gc = false;
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-mount", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("systemd-mount [OPTIONS...] WHAT [WHERE]\n"
"systemd-mount [OPTIONS...] --list\n"
"%s [OPTIONS...] %sWHAT|WHERE...\n\n"
@@ -86,9 +93,14 @@ static void help(void) {
" --bind-device Bind automount unit to device\n"
" --list List mountable block devices\n"
" -u --umount Unmount mount points\n"
- " -G --collect Unload unit after it stopped, even when failed\n",
- program_invocation_short_name,
- streq(program_invocation_short_name, "systemd-umount") ? "" : "--umount ");
+ " -G --collect Unload unit after it stopped, even when failed\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , streq(program_invocation_short_name, "systemd-umount") ? "" : "--umount "
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -155,8 +167,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 3ab06f28e9..3d81b72eed 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -1067,7 +1067,14 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
return 0;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("networkctl", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...]\n\n"
"Query and control the networking subsystem.\n\n"
" -h --help Show this help\n"
@@ -1080,7 +1087,12 @@ static void help(void) {
" status [LINK...] Show link status\n"
" lldp [LINK...] Show LLDP neighbors\n"
" label Show current address label entries in the kernel\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -1110,8 +1122,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/network/wait-online/wait-online.c b/src/network/wait-online/wait-online.c
index c67ff95c76..2ba6329a7a 100644
--- a/src/network/wait-online/wait-online.c
+++ b/src/network/wait-online/wait-online.c
@@ -7,13 +7,21 @@
#include "manager.h"
#include "signal-util.h"
#include "strv.h"
+#include "terminal-util.h"
static bool arg_quiet = false;
static usec_t arg_timeout = 120 * USEC_PER_SEC;
static char **arg_interfaces = NULL;
static char **arg_ignore = NULL;
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-networkd-wait-online.service", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...]\n\n"
"Block until network is configured.\n\n"
" -h --help Show this help\n"
@@ -22,7 +30,12 @@ static void help(void) {
" -i --interface=INTERFACE Block until at least these interfaces have appeared\n"
" --ignore=INTERFACE Don't take these interfaces into account\n"
" --timeout=SECS Maximum time to wait for network connectivity\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
diff --git a/src/notify/notify.c b/src/notify/notify.c
index e928094d9a..7ee7c342ff 100644
--- a/src/notify/notify.c
+++ b/src/notify/notify.c
@@ -15,6 +15,7 @@
#include "parse-util.h"
#include "string-util.h"
#include "strv.h"
+#include "terminal-util.h"
#include "user-util.h"
#include "util.h"
@@ -25,7 +26,14 @@ static bool arg_booted = false;
static uid_t arg_uid = UID_INVALID;
static gid_t arg_gid = GID_INVALID;
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-notify", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [VARIABLE=VALUE...]\n\n"
"Notify the init system about service status updates.\n\n"
" -h --help Show this help\n"
@@ -34,8 +42,13 @@ static void help(void) {
" --pid[=PID] Set main PID of daemon\n"
" --uid=USER Set user to send from\n"
" --status=TEXT Set status text\n"
- " --booted Check if the system was booted up with systemd\n",
- program_invocation_short_name);
+ " --booted Check if the system was booted up with systemd\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -70,8 +83,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 9a2f72bf29..b39afb0f9c 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -204,9 +204,16 @@ static unsigned arg_cpuset_ncpus = 0;
static ResolvConfMode arg_resolv_conf = RESOLV_CONF_AUTO;
static TimezoneMode arg_timezone = TIMEZONE_AUTO;
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
(void) pager_open(false, false);
+ r = terminal_urlify_man("systemd-nspawn", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [PATH] [ARGUMENTS...]\n\n"
"Spawn a command or OS in a light-weight container.\n\n"
" -h --help Show this help\n"
@@ -299,7 +306,12 @@ static void help(void) {
" --volatile[=MODE] Run the system in volatile mode\n"
" --settings=BOOLEAN Load additional settings from .nspawn file\n"
" --notify-ready=BOOLEAN Receive notifications from the child init process\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int custom_mount_check_all(void) {
@@ -532,8 +544,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/partition/growfs.c b/src/partition/growfs.c
index 6f1aa28933..2712849414 100644
--- a/src/partition/growfs.c
+++ b/src/partition/growfs.c
@@ -23,6 +23,7 @@
#include "parse-util.h"
#include "path-util.h"
#include "strv.h"
+#include "terminal-util.h"
static const char *arg_target = NULL;
static bool arg_dry_run = false;
@@ -152,14 +153,26 @@ static int maybe_resize_slave_device(const char *mountpath, dev_t main_devno) {
return 0;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-growfs@.service", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] /path/to/mountpoint\n\n"
"Grow filesystem or encrypted payload to device size.\n\n"
"Options:\n"
" -h --help Show this help and exit\n"
" --version Print version string and exit\n"
" -n --dry-run Just print what would be done\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -182,12 +195,10 @@ static int parse_argv(int argc, char *argv[]) {
while ((c = getopt_long(argc, argv, "hn", options, NULL)) >= 0)
switch(c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
- version();
- return 0;
+ return version();
case 'n':
arg_dry_run = true;
diff --git a/src/path/path.c b/src/path/path.c
index 7bd30f22d4..918638ff80 100644
--- a/src/path/path.c
+++ b/src/path/path.c
@@ -11,6 +11,7 @@
#include "log.h"
#include "macro.h"
#include "string-util.h"
+#include "terminal-util.h"
#include "util.h"
static const char *arg_suffix = NULL;
@@ -102,13 +103,25 @@ static int print_home(const char *n) {
return -EOPNOTSUPP;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-path", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [NAME...]\n\n"
"Show system and user paths.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
- " --suffix=SUFFIX Suffix to append to paths\n",
- program_invocation_short_name);
+ " --suffix=SUFFIX Suffix to append to paths\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -135,8 +148,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c
index b4895e6380..21e66def50 100644
--- a/src/portable/portablectl.c
+++ b/src/portable/portablectl.c
@@ -773,9 +773,15 @@ static int dump_profiles(void) {
}
static int help(int argc, char *argv[], void *userdata) {
+ _cleanup_free_ char *link = NULL;
+ int r;
(void) pager_open(arg_no_pager, false);
+ r = terminal_urlify_man("portablectl", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
"Attach or detach portable services from the local system.\n\n"
" -h --help Show this help\n"
@@ -803,7 +809,10 @@ static int help(int argc, char *argv[], void *userdata) {
" read-only NAME|PATH [BOOL] Mark or unmark portable service image read-only\n"
" remove NAME|PATH... Remove a portable service image\n"
" set-limit [NAME|PATH] Set image or pool size limit (disk quota)\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
return 0;
}
@@ -851,8 +860,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help(0, NULL, NULL);
- return 0;
+ return help(0, NULL, NULL);
case ARG_VERSION:
return version();
diff --git a/src/resolve/resolvconf-compat.c b/src/resolve/resolvconf-compat.c
index bf7b7b1044..013b215a80 100644
--- a/src/resolve/resolvconf-compat.c
+++ b/src/resolve/resolvconf-compat.c
@@ -14,8 +14,16 @@
#include "resolved-def.h"
#include "string-util.h"
#include "strv.h"
+#include "terminal-util.h"
+
+static int resolvconf_help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("resolvectl", "1", &link);
+ if (r < 0)
+ return log_oom();
-static void resolvconf_help(void) {
printf("%1$s -a INTERFACE < FILE\n"
"%1$s -d INTERFACE\n"
"\n"
@@ -34,7 +42,12 @@ static void resolvconf_help(void) {
"implementations are not supported and will cause the invocation to fail: -u,\n"
"-I, -i, -l, -R, -r, -v, -V, --enable-updates, --disable-updates,\n"
"--updates-are-enabled.\n"
- , program_invocation_short_name);
+ "\nSee the %2$s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_nameserver(const char *string) {
@@ -126,8 +139,7 @@ int resolvconf_parse_argv(int argc, char *argv[]) {
switch(c) {
case 'h':
- resolvconf_help();
- return 0; /* done */;
+ return resolvconf_help();
case ARG_VERSION:
return version();
diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c
index 1ac4683c5f..9792750fbf 100644
--- a/src/resolve/resolvectl.c
+++ b/src/resolve/resolvectl.c
@@ -2300,7 +2300,14 @@ static void help_dns_classes(void) {
DUMP_STRING_TABLE(dns_class, int, _DNS_CLASS_MAX);
}
-static void compat_help(void) {
+static int compat_help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("resolvectl", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%1$s [OPTIONS...] HOSTNAME|ADDRESS...\n"
"%1$s [OPTIONS...] --service [[NAME] TYPE] DOMAIN\n"
"%1$s [OPTIONS...] --openpgp EMAIL@DOMAIN...\n"
@@ -2341,10 +2348,22 @@ static void compat_help(void) {
" --set-dnssec=MODE Set per-interface DNSSEC mode\n"
" --set-nta=DOMAIN Set per-interface DNSSEC NTA\n"
" --revert Revert per-interface configuration\n"
- , program_invocation_short_name);
+ "\nSee the %2$s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
-static void native_help(void) {
+static int native_help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("resolvectl", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%1$s [OPTIONS...] {COMMAND} ...\n"
"\n"
"Send control commands to the network name resolution manager, or\n"
@@ -2385,12 +2404,16 @@ static void native_help(void) {
" dnssec [LINK [MODE]] Get/set per-interface DNSSEC mode\n"
" nta [LINK [DOMAIN...]] Get/set per-interface DNSSEC NTA\n"
" revert LINK Revert per-interface configuration\n"
- , program_invocation_short_name);
+ "\nSee the %2$s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int verb_help(int argc, char **argv, void *userdata) {
- native_help();
- return 0;
+ return native_help();
}
static int compat_parse_argv(int argc, char *argv[]) {
@@ -2463,8 +2486,7 @@ static int compat_parse_argv(int argc, char *argv[]) {
switch(c) {
case 'h':
- compat_help();
- return 0; /* done */;
+ return compat_help();
case ARG_VERSION:
return version();
@@ -2763,8 +2785,7 @@ static int native_parse_argv(int argc, char *argv[]) {
switch(c) {
case 'h':
- native_help();
- return 0; /* done */;
+ return native_help();
case ARG_VERSION:
return version();
diff --git a/src/run/run.c b/src/run/run.c
index 9ad44e7b57..5fe54d277a 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -58,7 +58,14 @@ static bool with_timer = false;
static bool arg_quiet = false;
static bool arg_aggressive_gc = false;
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-run", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] {COMMAND} [ARGS...]\n\n"
"Run the specified command in a transient scope or service.\n\n"
" -h --help Show this help\n"
@@ -98,7 +105,12 @@ static void help(void) {
" --on-unit-inactive=SECONDS Run SECONDS after the last deactivation\n"
" --on-calendar=SPEC Realtime timer\n"
" --timer-property=NAME=VALUE Set timer unit property\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int add_timer_property(const char *name, const char *val) {
@@ -196,8 +208,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index 0584afb95d..3b8d457839 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -21,6 +21,7 @@
#include "stdio-util.h"
#include "string-util.h"
#include "strv.h"
+#include "terminal-util.h"
#include "util.h"
static char* arg_verb = NULL;
@@ -265,18 +266,30 @@ static int execute_s2h(usec_t hibernate_delay_sec) {
return r;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-suspend.service", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s COMMAND\n\n"
"Suspend the system, hibernate the system, or both.\n\n"
- "Commands:\n"
- " -h --help Show this help and exit\n"
- " --version Print version string and exit\n"
- " suspend Suspend the system\n"
- " hibernate Hibernate the system\n"
- " hybrid-sleep Both hibernate and suspend the system\n"
+ " -h --help Show this help and exit\n"
+ " --version Print version string and exit\n"
+ "\nCommands:\n"
+ " suspend Suspend the system\n"
+ " hibernate Hibernate the system\n"
+ " hybrid-sleep Both hibernate and suspend the system\n"
" suspend-then-hibernate Initially suspend and then hibernate\n"
- " the system after a fixed period of time\n"
- , program_invocation_short_name);
+ " the system after a fixed period of time\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -298,8 +311,7 @@ static int parse_argv(int argc, char *argv[]) {
while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0)
switch(c) {
case 'h':
- help();
- return 0; /* done */
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
index b302a77625..4c60d97c39 100644
--- a/src/socket-proxy/socket-proxyd.c
+++ b/src/socket-proxy/socket-proxyd.c
@@ -18,11 +18,12 @@
#include "alloc-util.h"
#include "fd-util.h"
#include "log.h"
+#include "parse-util.h"
#include "path-util.h"
#include "set.h"
#include "socket-util.h"
#include "string-util.h"
-#include "parse-util.h"
+#include "terminal-util.h"
#include "util.h"
#define BUFFER_SIZE (256 * 1024)
@@ -534,14 +535,26 @@ static int add_listen_socket(Context *context, int fd) {
return 0;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-socket-proxyd", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%1$s [HOST:PORT]\n"
"%1$s [SOCKET]\n\n"
"Bidirectionally proxy local sockets to another (possibly remote) socket.\n\n"
" -c --connections-max= Set the maximum number of connections to be accepted\n"
" -h --help Show this help\n"
- " --version Show package version\n",
- program_invocation_short_name);
+ " --version Show package version\n"
+ "\nSee the %2$s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -568,8 +581,10 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
+
+ case ARG_VERSION:
+ return version();
case 'c':
r = safe_atou(optarg, &arg_connections_max);
@@ -585,9 +600,6 @@ static int parse_argv(int argc, char *argv[]) {
break;
- case ARG_VERSION:
- return version();
-
case '?':
return -EINVAL;
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index 0151f7dabe..945ae3746b 100644
--- a/src/sysctl/sysctl.c
+++ b/src/sysctl/sysctl.c
@@ -160,7 +160,14 @@ static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ign
return r;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-sysctl.service", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [CONFIGURATION FILE...]\n\n"
"Applies kernel sysctl settings.\n\n"
" -h --help Show this help\n"
@@ -168,7 +175,12 @@ static void help(void) {
" --cat-config Show configuration files\n"
" --prefix=PATH Only apply rules with the specified prefix\n"
" --no-pager Do not pipe output into a pager\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -199,8 +211,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 046bffdf05..b8beba17f1 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -7098,9 +7098,16 @@ end:
return r;
}
-static void systemctl_help(void) {
+static int systemctl_help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
(void) pager_open(arg_no_pager, false);
+ r = terminal_urlify_man("systemctl", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] {COMMAND} ...\n\n"
"Query or send control commands to the systemd manager.\n\n"
" -h --help Show this help\n"
@@ -7237,11 +7244,23 @@ static void systemctl_help(void) {
" hibernate Hibernate the system\n"
" hybrid-sleep Hibernate and suspend the system\n"
" suspend-then-hibernate Suspend the system, wake after a period of\n"
- " time and put it into hibernate\n",
- program_invocation_short_name);
+ " time and put it into hibernate\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
-static void halt_help(void) {
+static int halt_help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("halt", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...]%s\n\n"
"%s the system.\n\n"
" --help Show this help\n"
@@ -7251,15 +7270,27 @@ static void halt_help(void) {
" -f --force Force immediate halt/power-off/reboot\n"
" -w --wtmp-only Don't halt/power-off/reboot, just write wtmp record\n"
" -d --no-wtmp Don't write wtmp record\n"
- " --no-wall Don't send wall message before halt/power-off/reboot\n",
- program_invocation_short_name,
- arg_action == ACTION_REBOOT ? " [ARG]" : "",
- arg_action == ACTION_REBOOT ? "Reboot" :
- arg_action == ACTION_POWEROFF ? "Power off" :
- "Halt");
+ " --no-wall Don't send wall message before halt/power-off/reboot\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , arg_action == ACTION_REBOOT ? " [ARG]" : "",
+ arg_action == ACTION_REBOOT ? "Reboot" :
+ arg_action == ACTION_POWEROFF ? "Power off" :
+ "Halt"
+ , link
+ );
+
+ return 0;
}
-static void shutdown_help(void) {
+static int shutdown_help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("shutdown", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [TIME] [WALL...]\n\n"
"Shut down the system.\n\n"
" --help Show this help\n"
@@ -7269,11 +7300,23 @@ static void shutdown_help(void) {
" -h Equivalent to --poweroff, overridden by --halt\n"
" -k Don't halt/power-off/reboot, just send warnings\n"
" --no-wall Don't send wall message before halt/power-off/reboot\n"
- " -c Cancel a pending shutdown\n",
- program_invocation_short_name);
+ " -c Cancel a pending shutdown\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
-static void telinit_help(void) {
+static int telinit_help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("telinit", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] {COMMAND}\n\n"
"Send control commands to the init daemon.\n\n"
" --help Show this help\n"
@@ -7284,15 +7327,32 @@ static void telinit_help(void) {
" 2, 3, 4, 5 Start runlevelX.target unit\n"
" 1, s, S Enter rescue mode\n"
" q, Q Reload init daemon configuration\n"
- " u, U Reexecute init daemon\n",
- program_invocation_short_name);
+ " u, U Reexecute init daemon\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
-static void runlevel_help(void) {
+static int runlevel_help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("runlevel", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...]\n\n"
"Prints the previous and current runlevel of the init system.\n\n"
- " --help Show this help\n",
- program_invocation_short_name);
+ " --help Show this help\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static void help_types(void) {
@@ -7454,8 +7514,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- systemctl_help();
- return 0;
+ return systemctl_help();
case ARG_VERSION:
return version();
@@ -7829,8 +7888,7 @@ static int halt_parse_argv(int argc, char *argv[]) {
switch (c) {
case ARG_HELP:
- halt_help();
- return 0;
+ return halt_help();
case ARG_HALT:
arg_action = ACTION_HALT;
@@ -7965,8 +8023,7 @@ static int shutdown_parse_argv(int argc, char *argv[]) {
switch (c) {
case ARG_HELP:
- shutdown_help();
- return 0;
+ return shutdown_help();
case 'H':
arg_action = ACTION_HALT;
@@ -8086,8 +8143,7 @@ static int telinit_parse_argv(int argc, char *argv[]) {
switch (c) {
case ARG_HELP:
- telinit_help();
- return 0;
+ return telinit_help();
case ARG_NO_WALL:
arg_no_wall = true;
@@ -8150,8 +8206,7 @@ static int runlevel_parse_argv(int argc, char *argv[]) {
switch (c) {
case ARG_HELP:
- runlevel_help();
- return 0;
+ return runlevel_help();
case '?':
return -EINVAL;
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index 33959d3c11..91722408da 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -1759,7 +1759,14 @@ static int cat_config(void) {
return cat_files(NULL, files, 0);
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-sysusers.service", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [CONFIGURATION FILE...]\n\n"
"Creates system user accounts.\n\n"
" -h --help Show this help\n"
@@ -1769,7 +1776,12 @@ static void help(void) {
" --replace=PATH Treat arguments as replacement for PATH\n"
" --inline Treat arguments as configuration lines\n"
" --no-pager Do not pipe output into a pager\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -1804,8 +1816,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index a541b01920..6ed8934a46 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -694,6 +694,13 @@ static int show_timesync(int argc, char **argv, void *userdata) {
}
static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("timedatectl", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] COMMAND ...\n\n"
"Query or change system time and date settings.\n\n"
" -h --help Show this help message\n"
@@ -720,7 +727,10 @@ static int help(void) {
"systemd-timesyncd Commands:\n"
" timesync-status Show status of systemd-timesyncd\n"
" show-timesync Show properties of systemd-timesyncd\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
return 0;
}
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 69c611e6c4..f3c6f9ec5c 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -2814,7 +2814,14 @@ static int cat_config(char **config_dirs, char **args) {
return cat_files(NULL, files, 0);
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-tmpfiles", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...] [CONFIGURATION FILE...]\n\n"
"Creates, deletes and cleans up volatile and temporary files and directories.\n\n"
" -h --help Show this help\n"
@@ -2830,7 +2837,12 @@ static void help(void) {
" --root=PATH Operate on an alternate filesystem root\n"
" --replace=PATH Treat arguments as replacement for PATH\n"
" --no-pager Do not pipe output into a pager\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -2877,8 +2889,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c
index 40d594896b..2aa97a8d08 100644
--- a/src/tty-ask-password-agent/tty-ask-password-agent.c
+++ b/src/tty-ask-password-agent/tty-ask-password-agent.c
@@ -562,7 +562,14 @@ static int watch_passwords(void) {
return 0;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-tty-ask-password-agent", "1", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...]\n\n"
"Process system password requests.\n\n"
" -h --help Show this help\n"
@@ -572,8 +579,13 @@ static void help(void) {
" --watch Continuously process password requests\n"
" --wall Continuously forward password requests to wall\n"
" --plymouth Ask question with Plymouth instead of on TTY\n"
- " --console Ask question on /dev/console instead of current TTY\n",
- program_invocation_short_name);
+ " --console Ask question on /dev/console instead of current TTY\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -610,8 +622,7 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
return version();
diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c
index a4d3c6e77f..2edeb105f8 100644
--- a/src/udev/udevadm.c
+++ b/src/udev/udevadm.c
@@ -7,8 +7,9 @@
#include "selinux-util.h"
#include "string-util.h"
-#include "udev.h"
+#include "terminal-util.h"
#include "udev-util.h"
+#include "udev.h"
static int adm_version(struct udev *udev, int argc, char *argv[]) {
printf("%s\n", PACKAGE_VERSION);
@@ -41,7 +42,13 @@ static const struct udevadm_cmd *udevadm_cmds[] = {
};
static int adm_help(struct udev *udev, int argc, char *argv[]) {
- unsigned int i;
+ _cleanup_free_ char *link = NULL;
+ size_t i;
+ int r;
+
+ r = terminal_urlify_man("udevadm", "8", &link);
+ if (r < 0)
+ return log_oom();
printf("%s [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n\n"
"Send control commands or test the device manager.\n\n"
@@ -51,6 +58,8 @@ static int adm_help(struct udev *udev, int argc, char *argv[]) {
for (i = 0; i < ELEMENTSOF(udevadm_cmds); i++)
if (udevadm_cmds[i]->help != NULL)
printf(" %-12s %s\n", udevadm_cmds[i]->name, udevadm_cmds[i]->help);
+
+ printf("\nSee the %s for details.\n", link);
return 0;
}
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 264a91a32a..e4c15eaded 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1397,7 +1397,14 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
return 0;
}
-static void help(void) {
+static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-udevd.service", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s [OPTIONS...]\n\n"
"Manages devices.\n\n"
" -h --help Print this message\n"
@@ -1409,7 +1416,12 @@ static void help(void) {
" -t --event-timeout=SECONDS Seconds to wait before terminating an event\n"
" -N --resolve-names=early|late|never\n"
" When to resolve users and groups\n"
- , program_invocation_short_name);
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , link
+ );
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
@@ -1473,8 +1485,7 @@ static int parse_argv(int argc, char *argv[]) {
}
break;
case 'h':
- help();
- return 0;
+ return help();
case 'V':
printf("%s\n", PACKAGE_VERSION);
return 0;
diff --git a/src/veritysetup/veritysetup.c b/src/veritysetup/veritysetup.c
index 795af77aa6..61dcfd7cc2 100644
--- a/src/veritysetup/veritysetup.c
+++ b/src/veritysetup/veritysetup.c
@@ -9,17 +9,28 @@
#include "hexdecoct.h"
#include "log.h"
#include "string-util.h"
+#include "terminal-util.h"
static char *arg_root_hash = NULL;
static char *arg_data_what = NULL;
static char *arg_hash_what = NULL;
static int help(void) {
+ _cleanup_free_ char *link = NULL;
+ int r;
+
+ r = terminal_urlify_man("systemd-veritysetup@.service", "8", &link);
+ if (r < 0)
+ return log_oom();
+
printf("%s attach VOLUME DATADEVICE HASHDEVICE ROOTHASH\n"
"%s detach VOLUME\n\n"
- "Attaches or detaches an integrity protected block device.\n",
- program_invocation_short_name,
- program_invocation_short_name);
+ "Attaches or detaches an integrity protected block device.\n"
+ "\nSee the %s for details.\n"
+ , program_invocation_short_name
+ , program_invocation_short_name
+ , link
+ );
return 0;
}