diff --git a/man/systemd-binfmt.service.xml b/man/systemd-binfmt.service.xml index 37ac163f079..9de0a50c538 100644 --- a/man/systemd-binfmt.service.xml +++ b/man/systemd-binfmt.service.xml @@ -56,6 +56,7 @@ Options + diff --git a/man/systemd-sysctl.service.xml b/man/systemd-sysctl.service.xml index 5df310cff56..a5faabe1d34 100644 --- a/man/systemd-sysctl.service.xml +++ b/man/systemd-sysctl.service.xml @@ -80,6 +80,7 @@ + diff --git a/man/systemd-sysusers.xml b/man/systemd-sysusers.xml index ea119fe3752..e862498e80a 100644 --- a/man/systemd-sysusers.xml +++ b/man/systemd-sysusers.xml @@ -125,6 +125,7 @@ + diff --git a/man/systemd-tmpfiles.xml b/man/systemd-tmpfiles.xml index 3ef3fa28706..df9dac3548e 100644 --- a/man/systemd-tmpfiles.xml +++ b/man/systemd-tmpfiles.xml @@ -184,6 +184,7 @@ + diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c index 0eb9e460146..f4af4bef267 100644 --- a/src/binfmt/binfmt.c +++ b/src/binfmt/binfmt.c @@ -19,12 +19,14 @@ #include "fd-util.h" #include "fileio.h" #include "log.h" +#include "pager.h" #include "string-util.h" #include "strv.h" #include "terminal-util.h" #include "util.h" static bool arg_cat_config = false; +static bool arg_no_pager = false; static int delete_rule(const char *rule) { _cleanup_free_ char *x = NULL, *fn = NULL; @@ -104,6 +106,7 @@ static void help(void) { " -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); } @@ -112,12 +115,14 @@ static int parse_argv(int argc, char *argv[]) { enum { ARG_VERSION = 0x100, ARG_CAT_CONFIG, + ARG_NO_PAGER, }; static const struct option options[] = { - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, ARG_VERSION }, - { "cat-config", no_argument, NULL, ARG_CAT_CONFIG }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, ARG_VERSION }, + { "cat-config", no_argument, NULL, ARG_CAT_CONFIG }, + { "no-pager", no_argument, NULL, ARG_NO_PAGER }, {} }; @@ -141,6 +146,10 @@ static int parse_argv(int argc, char *argv[]) { arg_cat_config = true; break; + case ARG_NO_PAGER: + arg_no_pager = true; + break; + case '?': return -EINVAL; @@ -190,6 +199,8 @@ int main(int argc, char *argv[]) { } if (arg_cat_config) { + (void) pager_open(arg_no_pager, false); + r = cat_files(NULL, files, 0); goto finish; } @@ -205,5 +216,7 @@ int main(int argc, char *argv[]) { } finish: + pager_close(); + return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; } diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c index 5489cb96b7a..a719ea1f9d8 100644 --- a/src/sysctl/sysctl.c +++ b/src/sysctl/sysctl.c @@ -19,6 +19,7 @@ #include "fileio.h" #include "hashmap.h" #include "log.h" +#include "pager.h" #include "path-util.h" #include "string-util.h" #include "strv.h" @@ -28,6 +29,7 @@ static char **arg_prefixes = NULL; static bool arg_cat_config = false; +static bool arg_no_pager = false; static int apply_all(OrderedHashmap *sysctl_options) { char *property, *value; @@ -170,6 +172,7 @@ static void help(void) { " --version Show package version\n" " --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); } @@ -179,6 +182,7 @@ static int parse_argv(int argc, char *argv[]) { ARG_VERSION = 0x100, ARG_CAT_CONFIG, ARG_PREFIX, + ARG_NO_PAGER, }; static const struct option options[] = { @@ -186,6 +190,7 @@ static int parse_argv(int argc, char *argv[]) { { "version", no_argument, NULL, ARG_VERSION }, { "cat-config", no_argument, NULL, ARG_CAT_CONFIG }, { "prefix", required_argument, NULL, ARG_PREFIX }, + { "no-pager", no_argument, NULL, ARG_NO_PAGER }, {} }; @@ -231,6 +236,10 @@ static int parse_argv(int argc, char *argv[]) { break; } + case ARG_NO_PAGER: + arg_no_pager = true; + break; + case '?': return -EINVAL; @@ -287,6 +296,8 @@ int main(int argc, char *argv[]) { } if (arg_cat_config) { + (void) pager_open(arg_no_pager, false); + r = cat_files(NULL, files, 0); goto finish; } @@ -303,6 +314,8 @@ int main(int argc, char *argv[]) { r = k; finish: + pager_close(); + ordered_hashmap_free_free_free(sysctl_options); strv_free(arg_prefixes); diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 7caa97e27b9..ccb3fca8f2f 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -13,10 +13,11 @@ #include "copy.h" #include "def.h" #include "fd-util.h" -#include "fs-util.h" #include "fileio-label.h" #include "format-util.h" +#include "fs-util.h" #include "hashmap.h" +#include "pager.h" #include "path-util.h" #include "selinux-util.h" #include "smack-util.h" @@ -35,6 +36,7 @@ typedef enum ItemType { ADD_MEMBER = 'm', ADD_RANGE = 'r', } ItemType; + typedef struct Item { ItemType type; @@ -65,6 +67,7 @@ static char *arg_root = NULL; static bool arg_cat_config = false; static const char *arg_replace = NULL; static bool arg_inline = false; +static bool arg_no_pager = false; static OrderedHashmap *users = NULL, *groups = NULL; static OrderedHashmap *todo_uids = NULL, *todo_gids = NULL; @@ -1764,6 +1767,8 @@ static int cat_config(void) { if (r < 0) return r; + (void) pager_open(arg_no_pager, false); + return cat_files(NULL, files, 0); } @@ -1776,6 +1781,7 @@ static void help(void) { " --root=PATH Operate on an alternate filesystem root\n" " --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); } @@ -1787,6 +1793,7 @@ static int parse_argv(int argc, char *argv[]) { ARG_ROOT, ARG_REPLACE, ARG_INLINE, + ARG_NO_PAGER, }; static const struct option options[] = { @@ -1796,6 +1803,7 @@ static int parse_argv(int argc, char *argv[]) { { "root", required_argument, NULL, ARG_ROOT }, { "replace", required_argument, NULL, ARG_REPLACE }, { "inline", no_argument, NULL, ARG_INLINE }, + { "no-pager", no_argument, NULL, ARG_NO_PAGER }, {} }; @@ -1839,6 +1847,10 @@ static int parse_argv(int argc, char *argv[]) { arg_inline = true; break; + case ARG_NO_PAGER: + arg_no_pager = true; + break; + case '?': return -EINVAL; @@ -1999,6 +2011,8 @@ int main(int argc, char *argv[]) { log_error_errno(r, "Failed to write files: %m"); finish: + pager_close(); + ordered_hashmap_free_with_destructor(groups, item_free); ordered_hashmap_free_with_destructor(users, item_free); diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 6bfa44f0761..183e98b3c16 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -48,6 +48,7 @@ #include "missing.h" #include "mkdir.h" #include "mount-util.h" +#include "pager.h" #include "parse-util.h" #include "path-lookup.h" #include "path-util.h" @@ -156,6 +157,7 @@ static bool arg_create = false; static bool arg_clean = false; static bool arg_remove = false; static bool arg_boot = false; +static bool arg_no_pager = false; static char **arg_include_prefixes = NULL; static char **arg_exclude_prefixes = NULL; @@ -2511,6 +2513,7 @@ static void help(void) { " --exclude-prefix=PATH Ignore rules with the specified prefix\n" " --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); } @@ -2528,6 +2531,7 @@ static int parse_argv(int argc, char *argv[]) { ARG_EXCLUDE_PREFIX, ARG_ROOT, ARG_REPLACE, + ARG_NO_PAGER, }; static const struct option options[] = { @@ -2543,6 +2547,7 @@ static int parse_argv(int argc, char *argv[]) { { "exclude-prefix", required_argument, NULL, ARG_EXCLUDE_PREFIX }, { "root", required_argument, NULL, ARG_ROOT }, { "replace", required_argument, NULL, ARG_REPLACE }, + { "no-pager", no_argument, NULL, ARG_NO_PAGER }, {} }; @@ -2612,6 +2617,10 @@ static int parse_argv(int argc, char *argv[]) { arg_replace = optarg; break; + case ARG_NO_PAGER: + arg_no_pager = true; + break; + case '?': return -EINVAL; @@ -2801,6 +2810,8 @@ int main(int argc, char *argv[]) { } if (arg_cat_config) { + (void) pager_open(arg_no_pager, false); + r = cat_config(config_dirs, argv + optind); goto finish; } @@ -2847,6 +2858,8 @@ int main(int argc, char *argv[]) { } finish: + pager_close(); + ordered_hashmap_free_with_destructor(items, item_array_free); ordered_hashmap_free_with_destructor(globs, item_array_free);