diff options
author | Djalal Harouni <tixxdz@opendz.org> | 2013-12-12 00:22:48 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-12-11 22:26:55 -0500 |
commit | faf5077f891aa249270b2a3d9f0104c3eec02da6 (patch) | |
tree | 65449f03aa0be1c97e2ee1418a75da66631760ee /src/journal | |
parent | 05b92756f74943a3d8c3ad13f5688c7dd22bd9ab (diff) |
journal: pipe journalctl help output into a pager
journalctl help output might run off the screen, so be consistent
as other systemd tools do and pipe it into a pager.
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journalctl.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 5d12c2b162..cc338e0987 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -114,8 +114,18 @@ typedef struct boot_id_t { uint64_t last; } boot_id_t; +static void pager_open_if_enabled(void) { + + if (arg_no_pager) + return; + + pager_open(arg_pager_end); +} + static int help(void) { + pager_open_if_enabled(); + printf("%s [OPTIONS...] [MATCHES...]\n\n" "Query the journal.\n\n" "Flags:\n" @@ -1647,8 +1657,8 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - if (!arg_no_pager && !arg_follow) - pager_open(arg_pager_end); + if (!arg_follow) + pager_open_if_enabled(); if (!arg_quiet) { usec_t start, end; |