summaryrefslogtreecommitdiff
path: root/src/shared/pager.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-02-12 03:30:10 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-02-12 01:10:31 -0500
commitf366d58dc1fe51b300167446597750d29687c3c5 (patch)
tree4dc0b0e4575dcf9ade9a0e2b9b1dd73c99bb3292 /src/shared/pager.c
parentdb999e0f923ca6c2c1b919d0f1c916472f209e62 (diff)
pager: support SYSTEMD_LESS environment variable
This allows customization of the arguments used by less. The main motivation is that some folks might not like having --no-init on every invocation of less.
Diffstat (limited to 'src/shared/pager.c')
-rw-r--r--src/shared/pager.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/shared/pager.c b/src/shared/pager.c
index 72a29f2285..55b13d6ff6 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -84,14 +84,17 @@ int pager_open(bool jump_to_end) {
/* In the child start the pager */
if (pager_pid == 0) {
+ const char* less_opts;
dup2(fd[0], STDIN_FILENO);
close_pipe(fd);
+ less_opts = getenv("SYSTEMD_LESS");
+ if (!less_opts)
+ less_opts = "FRSXMK";
if (jump_to_end)
- setenv("LESS", "FRSXMK+G", 1);
- else
- setenv("LESS", "FRSXMK", 1);
+ less_opts = strappenda(less_opts, " +G");
+ setenv("LESS", less_opts, 1);
/* Make sure the pager goes away when the parent dies */
if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0)