chiark / gitweb /
polkit: don't spawn local client if we access a remote system
[elogind.git] / src / shared / pager.c
index 488a12c763839f156471d1b56606fae5f06b8188..9fa611479cff0cc10b98c7d60ca0dbbfd3e3f00e 100644 (file)
@@ -34,17 +34,20 @@ static pid_t pager_pid = 0;
 
 _noreturn_ static void pager_fallback(void) {
         ssize_t n;
+
         do {
                 n = splice(STDIN_FILENO, NULL, STDOUT_FILENO, NULL, 64*1024, 0);
         } while (n > 0);
+
         if (n < 0) {
                 log_error("Internal pager failed: %m");
                 _exit(EXIT_FAILURE);
         }
+
         _exit(EXIT_SUCCESS);
 }
 
-int pager_open(void) {
+int pager_open(bool jump_to_end) {
         int fd[2];
         const char *pager;
         pid_t parent_pid;
@@ -85,7 +88,10 @@ int pager_open(void) {
                 dup2(fd[0], STDIN_FILENO);
                 close_pipe(fd);
 
-                setenv("LESS", "FRSX", 0);
+                if (jump_to_end)
+                        setenv("LESS", "FRSXMK+G", 1);
+                else
+                        setenv("LESS", "FRSXMK", 1);
 
                 /* Make sure the pager goes away when the parent dies */
                 if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0)