[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
343/376: Provide default pagers
From: |
Ludovic Courtès |
Subject: |
343/376: Provide default pagers |
Date: |
Wed, 28 Jan 2015 22:06:04 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit c56bfbe863322fe9d5d5748681ebcc0de7780c02
Author: Eelco Dolstra <address@hidden>
Date: Wed Dec 10 18:16:05 2014 +0100
Provide default pagers
Borrowed from systemd.
---
src/libmain/shared.cc | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 1d50346..8d06455 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -291,8 +291,9 @@ int handleExceptions(const string & programName,
std::function<void()> fun)
RunPager::RunPager()
{
- string pager = getEnv("PAGER");
- if (!isatty(STDOUT_FILENO) || pager.empty()) return;
+ if (!isatty(STDOUT_FILENO)) return;
+ string pager = getEnv("PAGER", "default");
+ if (pager == "" || pager == "cat") return;
/* Ignore SIGINT. The pager will handle it (and we'll get
SIGPIPE). */
@@ -312,7 +313,11 @@ RunPager::RunPager()
throw SysError("dupping stdin");
if (!getenv("LESS"))
setenv("LESS", "FRSXMK", 1);
- execl("/bin/sh", "sh", "-c", pager.c_str(), NULL);
+ if (pager != "default")
+ execl("/bin/sh", "sh", "-c", pager.c_str(), NULL);
+ execlp("pager", "pager", NULL);
+ execlp("less", "less", NULL);
+ execlp("more", "more", NULL);
throw SysError(format("executing ‘%1%’") % pager);
});
- 335/376: Don't use RPATH on Darwin, (continued)
- 335/376: Don't use RPATH on Darwin, Ludovic Courtès, 2015/01/28
- 337/376: Revert "Use posix_spawn to run the pager", Ludovic Courtès, 2015/01/28
- 334/376: Update signing.txt, Ludovic Courtès, 2015/01/28
- 336/376: Cruft, Ludovic Courtès, 2015/01/28
- 339/376: Include cacert in the binary tarball, Ludovic Courtès, 2015/01/28
- 340/376: Rename function, Ludovic Courtès, 2015/01/28
- 342/376: Don't do vfork in conjunction with setuid, Ludovic Courtès, 2015/01/28
- 341/376: Use vfork, Ludovic Courtès, 2015/01/28
- 345/376: allow custom docbook paths/URLs, use a working URL for docbook.rng, Ludovic Courtès, 2015/01/28
- 344/376: Urgh, Ludovic Courtès, 2015/01/28
- 343/376: Provide default pagers,
Ludovic Courtès <=
- 346/376: Don't use ?=, Ludovic Courtès, 2015/01/28
- 347/376: Remove canary stuff, Ludovic Courtès, 2015/01/28
- 348/376: Remove dead code, Ludovic Courtès, 2015/01/28
- 350/376: Doh, Ludovic Courtès, 2015/01/28
- 338/376: Don't wait for PID -1, Ludovic Courtès, 2015/01/28
- 352/376: Get rid of unnecessary "interrupted by the user" message with -vvv, Ludovic Courtès, 2015/01/28
- 353/376: Don't abort if we get a signal while waiting for the pager, Ludovic Courtès, 2015/01/28
- 351/376: Remove chatty message, Ludovic Courtès, 2015/01/28
- 356/376: Shut up a Valgrind warning, Ludovic Courtès, 2015/01/28
- 349/376: Remove tabs, Ludovic Courtès, 2015/01/28