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

Rich Felker dalias at aerifal.cx
Sun Jun 2 16:19:16 UTC 2013


On Sun, Jun 02, 2013 at 02:06:03PM +0200, John Spencer wrote:
> On 06/02/2013 12:51 PM, 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>
> >
> 
> ++    const char* env_pager = getenv("MANPAGER");
> ++    if (!env_pager) env_pager = getenv("PAGER");
> 
> maybe one could optimize this to
> 
> const char* env_pager = getenv("MANPAGER");
> if (!env_pager) env_pager = getenv("MANPAGER"+3);
> 
> so that 5 bytes are saved because the string is reused.

The compiler is free to, and should, make this optimization
automatically.

Rich


More information about the busybox mailing list