]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lib/pager: Allow PAGER commands with options
authorDragan Simic <dsimic@manjaro.org>
Tue, 4 Jul 2023 09:14:28 +0000 (11:14 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 11 Jul 2023 09:29:05 +0000 (11:29 +0200)
commit082b1f713e306208ec0d410eab3e7f906ec3d0e6
treeb9756e9c91fe08266e9dd7607b872bcff9ff50ca
parentc67a2b842d7a6479114caf8f90965c045d491ac2
lib/pager: Allow PAGER commands with options

It's quite common to have options in the commands specified in the
PAGER environment variable, to customize the behavior of the configured
output filter.  For example, someone might want to include the "-X"
option when less(1) is configured as the output filter, or might want
to specifically not include it, depending on the personal preferences.

For example, man(1), git(1) and bat(1) already allow and properly handle
the presence of any options in the configured output filter commands,
which assures that it's fine to do the same in util-linux.

Here's also a quotation from the description of the man(1) utility that
describes the PAGER environment variable, as found in The Single UNIX
Specification, version 4:

  PAGER
       Determine an output filtering command for writing the output
       to a terminal. Any string acceptable as a command_string operand
       to the sh -c command shall be valid. When standard output is
       a terminal device, the reference page output shall be piped
       through the command. If the PAGER variable is null or not set,
       the command shall be either more or another paginator utility
       documented in the system documentation.

This quotation just confirms, rather formally, that allowing options
in the output filter commands is a perfectly valid thing to do.

While there, perform a couple of minor cleanups as well, to make the
formatting of the code a tiny bit more consistent, and to slightly
improve one of the logged debug messages.

Signed-off-by: Dragan Simic <dsimic@manjaro.org>
lib/pager.c