[systemd-devel] [PATCH] journalctl: barrow logic from pager.c so that journalctl man page stays correct

Shawn Landen shawnlandden at gmail.com
Thu Jul 19 22:42:44 PDT 2012


particularly: "Pager to use when --no-pager is not given; overrides $PAGER.
  Setting this to an empty string or the value cat is equivalent to passing --no-pager."

After

commit 92a1fd9e95954a557d6fe27b56f5ef1b89fc2f5e
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Tue Jul 17 07:35:08 2012 +0200

    journalctl: do not ellipsize when using pager

This documentation became inaccurate
---
 src/journal/journalctl.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index e9810c9..9264d9c 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -313,6 +313,7 @@ int main(int argc, char *argv[]) {
         sd_id128_t previous_boot_id;
         bool previous_boot_id_valid = false;
         bool have_pager;
+        const char *pager;
 
         log_parse_environment();
         log_open();
@@ -399,6 +400,10 @@ int main(int argc, char *argv[]) {
         }
 
         have_pager = !arg_no_pager && !arg_follow;
+        if (have_pager)
+                if ((pager = getenv("SYSTEMD_PAGER")) || (pager = getenv("PAGER")))
+                        if (!*pager || streq(pager, "cat"))
+                                have_pager = false;
         if (have_pager) {
                 columns();
                 pager_open();
-- 
1.7.10.4



More information about the systemd-devel mailing list