X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Fpager.c;h=55b13d6ff63ecbf80198b5d9144c12fa5474320d;hp=9fa611479cff0cc10b98c7d60ca0dbbfd3e3f00e;hb=517d56b1d0f67dcf76710bc1e17b05518b8cabe6;hpb=46e65dcc3a522b5e992e165b5e61d14254026859 diff --git a/src/shared/pager.c b/src/shared/pager.c index 9fa611479..55b13d6ff 100644 --- a/src/shared/pager.c +++ b/src/shared/pager.c @@ -32,7 +32,7 @@ static pid_t pager_pid = 0; -_noreturn_ static void pager_fallback(void) { +noreturn static void pager_fallback(void) { ssize_t n; do { @@ -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)