From eb396f5b0bb17fecfc3db0045d2979fa42d4478d Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Mon, 20 Jul 2020 16:57:29 +0000 Subject: Switch the default pager from "more -s" to "less". POSIX explicitly allows using a different default pager if that is documented. Nowadays, the pager provided in most operating systems is less(1). Our man(1) implementation uses less(1) features that traditional more(1) did not provide, in particular tagging. Besides, as noted by deraadt@, the user interface of less(1) is slightly more refined and preferable over the user inferface of more(1). This switch was originally suggested by Ian Ropers. In ./configure, test whether less(1) is available. If not, fall back to more(1). In ./configure.local, support overriding the automatic test by setting BINM_PAGER. As explained by jmc@ and deraadt@, the -s flag was added a very long time ago when an antique version of groff(1) had an annoying bug in terminal output that would randomly display blank lines in the middle of pages. Clearly, -s has no longer been needed for many years, so drop it from the default pager invocation. OK deraadt@ jmc@ martijn@ job@ on the OpenBSD version of this patch. --- configure | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 1b1a5755..377d49c5 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: configure,v 1.76 2020/06/22 20:00:38 schwarze Exp $ +# $Id: configure,v 1.77 2020/07/20 16:57:30 schwarze Exp $ # # Copyright (c) 2014-2020 Ingo Schwarze # @@ -119,6 +119,7 @@ BINM_MAKEWHATIS="makewhatis" BINM_MAN="man" BINM_SOELIM="soelim" BINM_WHATIS="whatis" +BINM_PAGER= MANM_MAN="man" MANM_MANCONF="man.conf" MANM_MDOC="mdoc" @@ -343,18 +344,34 @@ else runtest fts FTS || true fi +# --- pager --- +manual= +if [ -n "${BINM_PAGER}" ]; then + manual=" (manual)" +elif less test-noop.c 1>/dev/null 2>&3; then + BINM_PAGER=less + echo "tested less: yes" 1>&2 + echo "tested less: yes" 1>&3 +else + BINM_PAGER=more + echo "tested less: no" 1>&2 + echo "tested less: no" 1>&3 +fi +echo "selected BINM_PAGER=${BINM_PAGER}${manual}" 1>&2 +echo "selected BINM_PAGER=${BINM_PAGER}${manual}" 1>&3 + # --- tagging support in the pager --- -if ismanual "less -T" LESS_T ${HAVE_LESS_T}; then +if ismanual "${BINM_PAGER} -T" LESS_T ${HAVE_LESS_T}; then : -elif less -ET /dev/null test-noop.c 1>/dev/null 2>&3; then +elif ${BINM_PAGER} -T /dev/null test-noop.c 1>/dev/null 2>&3; then HAVE_LESS_T=1 - echo "tested less -T: yes" 1>&2 - echo "tested less -T: yes" 1>&3 + echo "tested ${BINM_PAGER} -T: yes" 1>&2 + echo "tested ${BINM_PAGER} -T: yes" 1>&3 echo 1>&3 else HAVE_LESS_T=0 - echo "tested less -T: no" 1>&2 - echo "tested less -T: no" 1>&3 + echo "tested ${BINM_PAGER} -T: no" 1>&2 + echo "tested ${BINM_PAGER} -T: no" 1>&3 echo 1>&3 fi @@ -493,6 +510,7 @@ cat << __HEREDOC__ #define BINM_MAN "${BINM_MAN}" #define BINM_SOELIM "${BINM_SOELIM}" #define BINM_WHATIS "${BINM_WHATIS}" +#define BINM_PAGER "${BINM_PAGER}" __HEREDOC__ -- cgit v1.2.3-56-ge451