diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2020-09-28 21:34:09 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2020-09-28 21:34:09 +0200 |
commit | e60ffeeb206b177211249e26e2cb113e4e302d79 (patch) | |
tree | 674e2a875282cfd4c65de0697037792ab4b908b2 /sdn.cpp | |
parent | 9a2f6ab5cfcea44eeae0689b8c3c4c1d452156c0 (diff) | |
download | sdn-e60ffeeb206b177211249e26e2cb113e4e302d79.tar.gz sdn-e60ffeeb206b177211249e26e2cb113e4e302d79.tar.xz sdn-e60ffeeb206b177211249e26e2cb113e4e302d79.zip |
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.
Diffstat (limited to 'sdn.cpp')
-rw-r--r-- | sdn.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -879,7 +879,9 @@ fun run_program (initializer_list<const char*> 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: |