[systemd-devel] [PATCH] systemctl: implement auto-pager a la git

Lennart Poettering lennart at poettering.net
Mon Jan 3 16:18:05 PST 2011


On Sun, 02.01.11 14:07, Miklos Vajna (vmiklos at frugalware.org) wrote:

> On Sun, Jan 02, 2011 at 08:24:02AM +0100, Tollef Fog Heen <tfheen at err.no> wrote:
> > | +	if (!pager)
> > | +		pager = "less";
> >
> > Doesn't other distributions have sensible-pager(1) or pager(1)?  Also,
> > at least on Debian, less(1) isn't in the base distribution, while
> > more(1) comes from util-linux so is always around.
>
> Not all distributions have such a command, while all distributions have
> less packaged. What about making it a configure option, but let the
> default be 'less'? Then Debian and other packages can use
> --with-pager=pager or so.

The current git version simply uses $PAGER if it is set, and looks for
sensible-pager, less and more in this order and uses the first one that
is found. That should work on all distros, and doesn't require any
per-distro patching.

> > | +	setenv("LESS", "FRSX", 0);
> >
> > Here you're unconditionally overriding LESS.
>
> Hm, are you sure about this? setenv(3) writes:
>
> If name does exist in the environment, then its value is changed to value if
> overwrite  is  nonzero;  if  overwrite  is zero,  then  the  value of name is
> not changed.

Ah, dang, I correct your patch on this, but turns out you actually read
the man page and your code was correct.

/me undoes his own work.

Lennart

--
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list