From: Lyndon Nerenberg Date: Mon, 15 Oct 2012 22:21:48 +0000 (-0700) Subject: Allow $PAGER to override the compiled-in default pager command. X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=5548c9aa00ddf0989b2a0471a16e9d2f6d434983;p=mmh Allow $PAGER to override the compiled-in default pager command. --- diff --git a/config/config.c b/config/config.c index 63c272c..72da2cd 100644 --- a/config/config.c +++ b/config/config.c @@ -215,7 +215,7 @@ char *installproc = nmhlibdir (/install-mh); * draft message. */ -char *lproc = DEFAULT_PAGER; +char *lproc = NULL; /* * This is the path for the Bell equivalent mail program. @@ -229,7 +229,7 @@ char *mailproc = nmhbindir (/mhmail); * or message parts of type text/plain. */ -char *moreproc = DEFAULT_PAGER; +char *moreproc = NULL; /* * This is the program (mhl) used to filter messages. It is diff --git a/docs/pending-release-notes b/docs/pending-release-notes index fcc99a7..32080e7 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -26,6 +26,7 @@ NEW FEATURES existing files. - Added -noall/-all switches to sortm(1). sortm -noall requires a messages argument. +- $PAGER overrides the compiled-in default pager command. ---------------------------- diff --git a/man/mh-profile.man b/man/mh-profile.man index 949cf97..e7eb611 100644 --- a/man/mh-profile.man +++ b/man/mh-profile.man @@ -429,6 +429,9 @@ also used by the draft folder facility in and .B repl to display the draft message. +(Note that +.B $PAGER +supersedes the default built-in pager command.) .RE .PP .BR mailproc : @@ -488,6 +491,9 @@ formatted message when displaying to a terminal. It is also the default program used by .B mhshow to display message bodies (or message parts) of type text/plain. +(Note that +.B $PAGER +supersedes the default built-in pager command.) .RE .PP .BR mshproc : @@ -827,6 +833,12 @@ profile entry will display debugging information about the values in that entry. .RE .PP +.B $PAGER +.RS 5 +If set to a non-null value, this supersedes the value of +the default built-in pager command. +.RE +.PP .B $editalt .RS 5 This is the alternate message. diff --git a/sbr/readconfig.c b/sbr/readconfig.c index 4cf05f1..1ddd648 100644 --- a/sbr/readconfig.c +++ b/sbr/readconfig.c @@ -106,6 +106,23 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx) break; } + /* + * Special handling for the pager processes: lproc and moreproc. + * + * If they are not set by the profile, use the callers $PAGER if + * available, otherwise set them to DEFAULT_PAGER. + */ + if (lproc == NULL) { + lproc = getenv("PAGER"); + if (lproc == NULL || lproc[0] == '\0') + lproc = DEFAULT_PAGER; + } + if (moreproc == NULL) { + moreproc = getenv("PAGER"); + if (moreproc == NULL || moreproc[0] == '\0') + moreproc = DEFAULT_PAGER; + } + if (opp == NULL) { /* Check for duplicated non-null profile entries. Except allow multiple profile entries named "#", because that's