packages: adapter - use less only if terminal is to short

Elan Ruusamäe glen at pld-linux.org
Tue Dec 1 09:00:43 CET 2009


On Tuesday 01 December 2009 04:39:48 sparky wrote:
> +showdiff()
> +{
> +       l=$(cat $1 | wc -l)
local $l maybe?

> +       eval $(resize) # get terminal size

resize is x11/xorg dep, and can be missing on some systems.

use stty size instead:
set -- $(stty size)

> +       if [ $l -gt $LINES ]; then
> +               diffcol $1 | less -r
> +       else
> +               diffcol $1
> +       fi
> +}

why you just don't set "less -E" ?

and rather set it privately in $LESS, as i personally do expect the "q" to be 
input, and if sometimes it's not input, the "q" might go to wrong place.

-- 
glen


More information about the pld-devel-en mailing list