[PATCH] man: use less as default pager and parse DEFINE lines defining pager

Tito farmatito at tiscali.it
Sun Jun 2 16:03:51 UTC 2013


On Sunday 02 June 2013 14:01:01 John Spencer wrote:
> On 06/02/2013 01:48 PM, Tito wrote:
> > On Sunday 02 June 2013 12:51:21 John Spencer wrote:
> >> man.config can define lines such as
> >> DEFINE         pager   less -s
> >>
> >> this patch parses them, additionally it always sets pager to less
> >> instead of more.
> >>
> >> Signed-off-by: John Spencer<maillist-busybox at barfooze.de>
> >>
> >>
> >
> >
> > +               /* environment overrides setting from man.config */
> > +               const char* env_pager = getenv("MANPAGER");
> > +               if (!env_pager) env_pager = getenv("PAGER");
> > +               if (env_pager) pager = env_pager;
> > +               if (!pager) pager = "less";
> >
> > Hi,
> 
> hi,
> 
> > what if there is no less on the system?
> > Maybe we should check at config time that at least one
> > of the pagers (more, less) is enabled an use that as default
> > and eventually if both are enabled prefer less.
> 
> 1) more should always just be a simple wrapper around less
Hi,
who says that?

debian:~$ ls -la /bin/more
-rwxr-xr-x 1 root root 34476 Dec  9 17:56 /bin/more
debian:~$ ls -la /bin/less
-rwxr-xr-x 1 root root 145320 Jun 10  2012 /bin/less

> 2) it's possible to build busybox without less and more, and use the 
> "real less" package from elsewhere - just because busybox' less is not 
> built does not guarantee it's missing.

In this case when both more and less are not busybox applets you
can set whatever default you like depending on your taste but
you cannot foresee other users setup.
I prefer solutions that work out of the box 
and it makes sense to me to set one of them as default
if they are compiled in because this "Surely works®".

> 3) in case both more and less are missing, the sysadmin can now DEFINE 
> the pager via /etc/man.config

Yes, this seems one more good argument to set sane defaults e.g.
busybox applets as the sysdmin can overturn this settings easily
if your patch is applied.
 
Ciao,
Tito
> >
> > Just my 2 cents.
> >
> > Ciao,
> > Tito


More information about the busybox mailing list