From e60ffeeb206b177211249e26e2cb113e4e302d79 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Mon, 28 Sep 2020 21:34:09 +0200 Subject: Improve PAGER defaults We basically need less(1), nothing else will work correctly. I'm not sure where I took pager(1) from, might be a Debian thing. --- sdn.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdn.cpp b/sdn.cpp index 793ad27..fc87eb5 100644 --- a/sdn.cpp +++ b/sdn.cpp @@ -879,7 +879,9 @@ fun run_program (initializer_list list, const string &filename) { } fun view (const string &filename) { - run_program ({(const char *) getenv ("PAGER"), "pager", "cat"}, filename); + // XXX: we cannot realistically detect that the pager hasn't made a pause + // at the end of the file, so we can't ensure all contents have been seen + run_program ({(const char *) getenv ("PAGER"), "less", "cat"}, filename); } fun edit (const string &filename) { @@ -903,7 +905,7 @@ fun run_pager (FILE *contents) { dup2 (fileno (contents), STDIN_FILENO); // Behaviour copies man-db's man(1), similar to POSIX man(1) - for (auto pager : {(const char *) getenv ("PAGER"), "pager", "cat"}) + for (auto pager : {(const char *) getenv ("PAGER"), "less", "cat"}) if (pager) execl ("/bin/sh", "/bin/sh", "-c", pager, NULL); _exit (EXIT_FAILURE); default: -- cgit v1.2.3-70-g09d2