On Sun, Jul 19, 2020 at 05:36:34PM +0200, Ingo Schwarze wrote:
> Hi,
> 
> currently, if neither the MANPAGER nor the PAGER environment variable
> is set, man(1) uses "more -s" as the manual page pager.  I am quite
> sure that the only reason i did this is that i thought this behaviour
> was required by POSIX.
> 
> But it is not:
> 
>   https://pubs.opengroup.org/onlinepubs/9699919799/utilities/man.html
> 
>   "If the PAGER variable is null or not set,
>    the command shall be either "more" or another
>    paginator utility documented in the system documentation."
> 
> Right now, i even failed to find any indication that POSIX ever
> required more(1) as the default for this purpose.  I no longer
> understand where i got that idea from in the first place.
> 
> That said, on OpenBSD, the pager we provide is less(1).  In effect,
> it is less(1) even when called as more(1), albeit with minor
> differences in the default behaviour.  On top of that, our man(1)
> utility heavily relies on less(1) features that tradional more(1)
> wouldn't even have, in particular tagging support (:t).
> 
> So, i would find it logical to use less(1) as the default pager
> instead of more(1).
> 
> Same thing for the "-s" option: i thought it was required by POSIX,
> but it isn't.  I also provides little benefit, if any, and it may
> occasionally break output, in the rare case where two consecutive
> blank lines are syntacically significant (for example in an EXAMPLES
> section presenting a code sample).  Besides, if the author deliberately
> chose to put two consecutive blank lines, i don't see why man(1)
> should squeeze them and override the author's intent.
> 
> Is anybody concerned about the following patch, or would you agree
> with it?
> 
> Yours,
>   Ingo
> 

hi.

i guess the argument in favour of more(1) would be that it is part of
posix, even if optional, where less(1) is not. so it makes sense to
choose a command most likely to work on most machines.

having said that, i've nothing against the switch. i imagine it'd be
hard to find a system without less(1).

about -s: it's inclusion probably comes from a time when there was an
annoying bug in nroff that made our man pages randomly display a number
of blank lines in the middle of a page. -s mitigated that somewhat.

jmc

> 
> Index: apropos.1
> ===================================================================
> RCS file: /cvs/src/usr.bin/mandoc/apropos.1,v
> retrieving revision 1.41
> diff -u -p -r1.41 apropos.1
> --- apropos.1 22 Nov 2018 12:32:10 -0000      1.41
> +++ apropos.1 19 Jul 2020 15:18:30 -0000
> @@ -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,7 +363,7 @@ Specifies the pagination program to use 
>  .Ev MANPAGER
>  is not defined.
>  If neither PAGER nor MANPAGER is defined,
> -.Xr more 1
> +.Xr less 1
>  .Fl s
>  is used.
>  Only used if
> Index: main.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/mandoc/main.c,v
> retrieving revision 1.253
> diff -u -p -r1.253 main.c
> --- main.c    15 Jun 2020 17:25:03 -0000      1.253
> +++ main.c    19 Jul 2020 15:18:31 -0000
> @@ -1194,7 +1194,7 @@ spawn_pager(struct outstate *outst, char
>       if (pager == NULL || *pager == '\0')
>               pager = getenv("PAGER");
>       if (pager == NULL || *pager == '\0')
> -             pager = "more -s";
> +             pager = "less";
>       cp = mandoc_strdup(pager);
>  
>       /*
> Index: man.1
> ===================================================================
> RCS file: /cvs/src/usr.bin/mandoc/man.1,v
> retrieving revision 1.37
> diff -u -p -r1.37 man.1
> --- man.1     17 Jun 2020 19:41:25 -0000      1.37
> +++ man.1     19 Jul 2020 15:18:31 -0000
> @@ -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,7 +329,7 @@ Specifies the pagination program to use 
>  .Ev MANPAGER
>  is not defined.
>  If neither PAGER nor MANPAGER is defined,
> -.Xr more 1
> +.Xr less 1
>  .Fl s
>  is used.
>  .El
> Index: mandoc.1
> ===================================================================
> RCS file: /cvs/src/usr.bin/mandoc/mandoc.1,v
> retrieving revision 1.168
> diff -u -p -r1.168 mandoc.1
> --- mandoc.1  15 Jun 2020 18:05:25 -0000      1.168
> +++ mandoc.1  19 Jul 2020 15:18:31 -0000
> @@ -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,7 +664,7 @@ Specifies the pagination program to use 
>  .Ev MANPAGER
>  is not defined.
>  If neither PAGER nor MANPAGER is defined,
> -.Xr more 1
> +.Xr less 1
>  .Fl s
>  is used.
>  Only used if

Reply via email to