From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 22842 invoked from network); 20 Jul 2020 16:58:05 -0000 Received: from bsd.lv (HELO mandoc.bsd.lv) (66.111.2.12) by inbox.vuxu.org with ESMTPUTF8; 20 Jul 2020 16:58:05 -0000 Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id 3859ee33 for ; Mon, 20 Jul 2020 11:58:00 -0500 (EST) Received: from localhost (mandoc.bsd.lv [local]) by mandoc.bsd.lv (OpenSMTPD) with ESMTPA id 4811dce4 for ; Mon, 20 Jul 2020 11:58:00 -0500 (EST) Date: Mon, 20 Jul 2020 11:58:00 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: Switch the default pager from "more -s" to "less". X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: <490e047df2f5c8b7@mandoc.bsd.lv> Log Message: ----------- 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. Modified Files: -------------- mandoc: apropos.1 configure configure.local.example main.c man.1 mandoc.1 Revision Data ------------- Index: configure =================================================================== RCS file: /home/cvs/mandoc/mandoc/configure,v retrieving revision 1.76 retrieving revision 1.77 diff -Lconfigure -Lconfigure -u -p -r1.76 -r1.77 --- configure +++ configure @@ -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__ Index: man.1 =================================================================== RCS file: /home/cvs/mandoc/mandoc/man.1,v retrieving revision 1.39 retrieving revision 1.40 diff -Lman.1 -Lman.1 -u -p -r1.39 -r1.40 --- man.1 +++ man.1 @@ -74,7 +74,7 @@ See for a description of the contents of this file. .It Fl c Copy the manual page to the standard output instead of using -.Xr more 1 +.Xr less 1 to paginate it. This is done by default if the standard output is not a terminal device. .Pp @@ -275,7 +275,7 @@ is case insensitive. Any non-empty value of the environment variable .Ev MANPAGER is used instead of the standard pagination program, -.Xr more 1 . +.Xr less 1 . If .Xr less 1 is used, the interactive @@ -329,8 +329,7 @@ Specifies the pagination program to use .Ev MANPAGER is not defined. If neither PAGER nor MANPAGER is defined, -.Xr more 1 -.Fl s +.Xr less 1 is used. .El .Sh FILES Index: mandoc.1 =================================================================== RCS file: /home/cvs/mandoc/mandoc/mandoc.1,v retrieving revision 1.244 retrieving revision 1.245 diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.244 -r1.245 --- mandoc.1 +++ mandoc.1 @@ -52,13 +52,13 @@ The options are as follows: If the standard output is a terminal device and .Fl c is not specified, use -.Xr more 1 +.Xr less 1 to paginate the output, just like .Xr man 1 would. .It Fl c Copy the formatted manual pages to the standard output without using -.Xr more 1 +.Xr less 1 to paginate them. This is the default. It can be specified to override @@ -650,7 +650,7 @@ It never affects the interpretation of i Any non-empty value of the environment variable .Ev MANPAGER is used instead of the standard pagination program, -.Xr more 1 ; +.Xr less 1 ; see .Xr man 1 for details. @@ -664,8 +664,7 @@ Specifies the pagination program to use .Ev MANPAGER is not defined. If neither PAGER nor MANPAGER is defined, -.Xr more 1 -.Fl s +.Xr less 1 is used. Only used if .Fl a Index: configure.local.example =================================================================== RCS file: /home/cvs/mandoc/mandoc/configure.local.example,v retrieving revision 1.38 retrieving revision 1.39 diff -Lconfigure.local.example -Lconfigure.local.example -u -p -r1.38 -r1.39 --- configure.local.example +++ configure.local.example @@ -151,6 +151,14 @@ BINM_WHATIS=mwhatis # default is "whati BINM_MAKEWHATIS=mandocdb # default is "makewhatis" BINM_SOELIM=msoelim # default is "soelim" +# If less(1) is available, it is used as the default manual pager. +# Otherwise, more(1) is used: its existence is required by POSIX. +# It is possible to force using a different default pager, either +# by giving the name of a program found in the PATH, or by giving +# an absolute path. + +BINM_PAGER=pg # default is "less" or "more" + # Some distributions do not want hardlinks # between installed binary programs. # Set the following variable to use symbolic links instead. Index: apropos.1 =================================================================== RCS file: /home/cvs/mandoc/mandoc/apropos.1,v retrieving revision 1.49 retrieving revision 1.50 diff -Lapropos.1 -Lapropos.1 -u -p -r1.49 -r1.50 --- apropos.1 +++ apropos.1 @@ -73,7 +73,7 @@ would. If the standard output is a terminal device and .Fl c is not specified, use -.Xr more 1 +.Xr less 1 to paginate them. In .Fl a @@ -340,7 +340,7 @@ types appearing in function arguments in Any non-empty value of the environment variable .Ev MANPAGER is used instead of the standard pagination program, -.Xr more 1 ; +.Xr less 1 ; see .Xr man 1 for details. @@ -363,8 +363,7 @@ Specifies the pagination program to use .Ev MANPAGER is not defined. If neither PAGER nor MANPAGER is defined, -.Xr more 1 -.Fl s +.Xr less 1 is used. Only used if .Fl a Index: main.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/main.c,v retrieving revision 1.350 retrieving revision 1.351 diff -Lmain.c -Lmain.c -u -p -r1.350 -r1.351 --- main.c +++ main.c @@ -1218,7 +1218,7 @@ spawn_pager(struct outstate *outst, char if (pager == NULL || *pager == '\0') pager = getenv("PAGER"); if (pager == NULL || *pager == '\0') - pager = "more -s"; + pager = BINM_PAGER; cp = mandoc_strdup(pager); /* -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv