summaryrefslogtreecommitdiff
path: root/man/man1
diff options
context:
space:
mode:
authorNeven Sajko <nsajko@gmail.com>2018-01-16 12:23:27 +0000
committerColin Watson <cjwatson@debian.org>2018-01-16 12:44:42 +0000
commitb8428ce0ff42a715038fe578598e1d7d19c4fd35 (patch)
treeeaeaddee5e603d704b7746e75f930340c152a3f6 /man/man1
parentb32977ff73220cd351387abe558fb523d1deedbb (diff)
Add fallback pager if the compile-time default is not executable
A problem with man-db's man is that in the case of the user giving no configuration via conf files, argv, or environment variables; man defaults to less as pager (PAGER); but less may not be present on the system. Sure, other pagers may be selected in aforementioned ways, but then the defaults are overridden, making that unsuitable for install-time configuration. This patch makes man check (if that becomes relevant) if PAGER is executable, further defaulting to cat (which is basically ubiquitous, being in original Unix, POSIX, and GNU Coreutils) if it is not. Thus the poor beginner Unix users without less installed will be able to get man pages. * src/man.c (sh_lang_first_word): New function. (main): Skip configured pager if it is not executable. * man/man1/man.man1 (Controlling formatted output, ENVIRONMENT): Document fallback to cat. * man/replace.sin.in: Substitute %cat%.
Diffstat (limited to 'man/man1')
-rw-r--r--man/man1/man.man113
1 files changed, 11 insertions, 2 deletions
diff --git a/man/man1/man.man1 b/man/man1/man.man1
index 4df2823f..740ae983 100644
--- a/man/man1/man.man1
+++ b/man/man1/man.man1
@@ -874,7 +874,12 @@ Specify which output pager to use.
By default,
.B %man%
uses
-.BR "%pager%" .
+.BR "%pager%" ,
+falling back to
+.B %cat%
+if
+.B %pager%
+is not found or is not executable.
This option overrides the
.RB $ MANPAGER
environment variable, which in turn overrides the
@@ -1240,7 +1245,11 @@ is used in preference), its value is used as the name of the program used to
display the manual page.
By default,
.B %pager%
-is used.
+is used, falling back to
+.B %cat%
+if
+.B %pager%
+is not found or is not executable.
The value may be a simple command name or a command with arguments, and may
use shell quoting (backslashes, single quotes, or double quotes).