chiark / gitweb /
pager: add K to less environment
[elogind.git] / src / shared / pager.c
index 6799787e85b0cf7d339e23d553b328b6fbd9d3ab..5165d2b1c854f101285e8e58fef06d297a66f988 100644 (file)
@@ -57,7 +57,7 @@ int pager_open(void) {
                 if (!*pager || streq(pager, "cat"))
                         return 0;
 
                 if (!*pager || streq(pager, "cat"))
                         return 0;
 
-        if (isatty(STDOUT_FILENO) <= 0)
+        if (!on_tty())
                 return 0;
 
         /* Determine and cache number of columns before we spawn the
                 return 0;
 
         /* Determine and cache number of columns before we spawn the
@@ -85,7 +85,7 @@ int pager_open(void) {
                 dup2(fd[0], STDIN_FILENO);
                 close_pipe(fd);
 
                 dup2(fd[0], STDIN_FILENO);
                 close_pipe(fd);
 
-                setenv("LESS", "FRSX", 0);
+                setenv("LESS", "FRSXK", 0);
 
                 /* Make sure the pager goes away when the parent dies */
                 if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0)
 
                 /* Make sure the pager goes away when the parent dies */
                 if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0)