Re: MANPAGER

2021-06-04 Thread Ingo Schwarze
Hi Heinrich,

Heinrich Rebehn wrote on Sun, May 30, 2021 at 10:02:41AM +0200:

> I did see LESS_IS_MORE, but there were probably good reasons for
> the OpenBSD devs to switch to less(1).

Prosaic as it may seem, and featurism indeed feeling not too typical
for OpenBSD, my reason for switching basically was that less(1) has
more features and more(1) feels slightly antiquated.  Besides, our
implementation of more(1) is less(1) anyway under the hood, so there
is little reason to artificially restrict its functionality.  Also,
having :t tagging enabled by default and yet calling it "more" felt a
bit weird.  Finally, POSIX allows using an implementation-specific
pager by default as long as that is documented:

  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/man.html
  see the "PAGER" entry below "ENVIRONMENT VARIABLES":

  If the PAGER variable is null or not set, the command shall be
  either "more" or another paginator utility documented in the system
  documentation.

> 'MANPAGER="less -X" does the trick, I was not aware that "termcap
> initialization and deinitialization" is responsible for clrscreen.
> I hope that disabling it completely will not have any adverse side
> affects.

Reading less/opttbl.c, -X sets the global no_init variable,
and judging from "grep -RF no_init /usr/src/usr.bin/less/",
that's only used at two places in less/screen.c, using tputs(3)
to send the enter_ca_mode and exit_ca_mode strings defined in .
According to terminfo(5), these two capabilities are terminal-dependent.
So -X has different effects depending on which terminal or teminal
emulator you are using and with which setting of the TERM variable.
The worst that might happen on some terminals is that less(1) might
display gibberish and/or leave the terminal in an unusable state when
exiting.  But i assume you will notice if -X has undesirable effects
on the terminal you are using.

Theoretically, fiddling with such low-level options might have security
implications, putting the terminal into a state where it interprets
what you are typing afterwards in a way you never intended.  Then
again, while printing random binary data to a terminal can definitely
have security implications depending on how the terminal is configured -
the default configuration of xterm(1) being quite sane on OpenBSD -
i never heard about real-world security issues caused by partially
skipping terminal initialization or de-initialization, so they seem
somewhat unlikely.  This isn't a definite statement that none exist
on any terminal, though.

In any case, whether less(1) clears the screen when exiting is terminal-
dependent.  I just tried at the PC console (Strg-Alt-F2) on the same
amd64-current machine where less(1) in xterm(1) does clear the screen:
at the console, at least with TERM=vt220, it does not.

Yours,
  Ingo



Re: MANPAGER

2021-05-30 Thread Christian Groessler

On 5/29/21 11:18 PM, Allan Streib wrote:

Heinrich Rebehn  writes:


I noticed that OpenBSD 6.8 switched to using less(1) for the
manager. While this seems to offer many new useful options, I really
dislike the clrscreen upon exit.

Have a look at -X argument to less(1):

-X | --no-init
 Disables sending the termcap initialization and
 deinitialization strings to the terminal. This is
 sometimes desirable if the deinitialization string
 does something unnecessary, like clearing the
 screen.



Yeah. PAGER="less -X" is what I am using...

regards,
chris



Re: MANPAGER

2021-05-30 Thread Heinrich Rebehn



> On 29. May 2021, at 23:08, Leon Fischer  wrote:
> 
>> From: Heinrich Rebehn 
>> Date: Sat, 29 May 2021 21:37:40 +0200
>> 
>> Hi all,
>> 
>> I noticed that OpenBSD 6.8 switched to using less(1) for the manager. While 
>> this seems to offer many new useful options, I really dislike the clrscreen 
>> upon exit.
>> I browsed through the less(1) manage to find an option to disable this 
>> behavior, but to no avail.
>> Can anyone tell me how to restore the old behavior without reverting to 
>> using more(1)?
>> I am really used to still seeing the output of the man command when issuing 
>> the command that  i consulted man for.
>> 
>> Many thanks in advance,
>> 
>>  Heinrich
>> 
> 
> Use the -X option.  Add `export MANPAGER="less -X"` to ~/.profile to
> enable it for man(1), or `export LESS="-X"` to enable it for everything.

Thanks to all who replied!
I did see LESS_IS_MORE, but there were probably good reasons for the OpenBSD 
devs to switch to less(1).

'MANPAGER="less -X”` does the trick, I was not aware that "termcap 
initialization and deinitialization” is responsible for clrscreen. I hope that 
disabling it completely will not have any adverse side affects.

-Heinrich



Re: MANPAGER

2021-05-29 Thread Allan Streib
Heinrich Rebehn  writes:

> I noticed that OpenBSD 6.8 switched to using less(1) for the
> manager. While this seems to offer many new useful options, I really
> dislike the clrscreen upon exit.

Have a look at -X argument to less(1):

   -X | --no-init
Disables sending the termcap initialization and
deinitialization strings to the terminal. This is
sometimes desirable if the deinitialization string
does something unnecessary, like clearing the
screen.

Allan



Re: MANPAGER

2021-05-29 Thread Omar Polo


Heinrich Rebehn  writes:

> Hi all,
>
> I noticed that OpenBSD 6.8 switched to using less(1) for the manager. While 
> this seems to offer many new useful options, I really dislike the clrscreen 
> upon exit.
> I browsed through the less(1) manage to find an option to disable this 
> behavior, but to no avail.
> Can anyone tell me how to restore the old behavior without reverting to using 
> more(1)?
> I am really used to still seeing the output of the man command when issuing 
> the command that  i consulted man for.
>
> Many thanks in advance,
>
>   Heinrich

never used more, but the manpage of less mentions a LESS_IS_MORE env
variable to make less a bit more like, hum, more.

LESS_IS_MORE=1 less ...

doesn't clrscreen at exit.

HTH



MANPAGER

2021-05-29 Thread Heinrich Rebehn
Hi all,

I noticed that OpenBSD 6.8 switched to using less(1) for the manager. While 
this seems to offer many new useful options, I really dislike the clrscreen 
upon exit.
I browsed through the less(1) manage to find an option to disable this 
behavior, but to no avail.
Can anyone tell me how to restore the old behavior without reverting to using 
more(1)?
I am really used to still seeing the output of the man command when issuing the 
command that  i consulted man for.

Many thanks in advance,

Heinrich