summaryrefslogtreecommitdiffstats
path: root/src/udev
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-06-22 16:50:53 +0200
committerGitHub <noreply@github.com>2022-06-22 16:50:53 +0200
commita7b2aa658f35f4b9e91915eaa72afa648d0f9119 (patch)
tree8426630c4920e6e818b1a1e1c94cdbfeaa27ddd8 /src/udev
parentresolve: mDNS transaction max attempts fix (diff)
parentudevadm info: use pager for all output types (diff)
downloadsystemd-a7b2aa658f35f4b9e91915eaa72afa648d0f9119.tar.xz
systemd-a7b2aa658f35f4b9e91915eaa72afa648d0f9119.zip
Merge pull request #23806 from keszybz/udevadm-info-pager
Pager for udevadm info
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udevadm-info.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c
index d76dda95f1..04baed2e0c 100644
--- a/src/udev/udevadm-info.c
+++ b/src/udev/udevadm-info.c
@@ -51,6 +51,7 @@ static bool arg_export = false;
static bool arg_value = false;
static const char *arg_export_prefix = NULL;
static usec_t arg_wait_for_initialization_timeout = 0;
+PagerFlags arg_pager_flags = 0;
/* Put a limit on --tree descent level to not exhaust our stack */
#define TREE_DEPTH_MAX 64
@@ -294,6 +295,8 @@ static int export_devices(void) {
if (r < 0)
return log_error_errno(r, "Failed to scan devices: %m");
+ pager_open(arg_pager_flags);
+
FOREACH_DEVICE_AND_SUBSYSTEM(e, d)
(void) print_record(d, NULL);
@@ -496,7 +499,8 @@ static int help(void) {
" -e --export-db Export the content of the udev database\n"
" -c --cleanup-db Clean up the udev database\n"
" -w --wait-for-initialization[=SECONDS]\n"
- " Wait for device to be initialized\n",
+ " Wait for device to be initialized\n"
+ " --no-pager Do not pipe output into a pager\n",
program_invocation_short_name);
return 0;
@@ -667,6 +671,7 @@ int info_main(int argc, char *argv[], void *userdata) {
enum {
ARG_PROPERTY = 0x100,
ARG_VALUE,
+ ARG_NO_PAGER,
};
static const struct option options[] = {
@@ -686,6 +691,7 @@ int info_main(int argc, char *argv[], void *userdata) {
{ "value", no_argument, NULL, ARG_VALUE },
{ "version", no_argument, NULL, 'V' },
{ "wait-for-initialization", optional_argument, NULL, 'w' },
+ { "no-pager", no_argument, NULL, ARG_NO_PAGER },
{}
};
@@ -779,6 +785,9 @@ int info_main(int argc, char *argv[], void *userdata) {
return print_version();
case 'h':
return help();
+ case ARG_NO_PAGER:
+ arg_pager_flags |= PAGER_DISABLE;
+ break;
case '?':
return -EINVAL;
default:
@@ -808,9 +817,10 @@ int info_main(int argc, char *argv[], void *userdata) {
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"-x/--export or -P/--export-prefix cannot be used with --value");
+ pager_open(arg_pager_flags);
+
if (strv_isempty(devices)) {
assert(action == ACTION_TREE);
- pager_open(0);
return print_tree(NULL);
}