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

Miklos Vajna vmiklos at frugalware.org
Sun Jan 2 05:07:26 PST 2011


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.

> | +	else if (!*pager || !strcmp(pager, "cat"))
> | +		return;
> 
> Why special-casing cat?

To avoid launching an unnecessary process. 'systemctl | cat' and
'systemctl' is the same, except that the in previous case we do not
launch the pager.

> | +	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.

Thanks for the feedback,

Miklos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20110102/0b2a486b/attachment.pgp>


More information about the systemd-devel mailing list