summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-03-13 06:06:29 +0000
committerMike Frysinger <vapier@gentoo.org>2009-03-13 06:06:29 +0000
commit0cfec847556c6435568d0282b162efe47bddaeaa (patch)
treec8d405f7d2f60e360f37551dae3a41eaf89d7f18 /sys-apps/less/files/lesspipe.sh
parentfixup more test failures #259876 (diff)
downloadgentoo-2-0cfec847556c6435568d0282b162efe47bddaeaa.tar.gz
gentoo-2-0cfec847556c6435568d0282b162efe47bddaeaa.tar.bz2
gentoo-2-0cfec847556c6435568d0282b162efe47bddaeaa.zip
simplify lesscolor code detection
(Portage version: 2.2_rc25/cvs/Linux x86_64)
Diffstat (limited to 'sys-apps/less/files/lesspipe.sh')
-rw-r--r--sys-apps/less/files/lesspipe.sh15
1 files changed, 5 insertions, 10 deletions
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
index 9d7b9c8c8105..dc378db53029 100644
--- a/sys-apps/less/files/lesspipe.sh
+++ b/sys-apps/less/files/lesspipe.sh
@@ -188,18 +188,13 @@ lesspipe() {
exit 0
fi
- # Only colorize if user forces it ...
- if [[ ${LESSCOLOR} == "2" ]]; then
+ # 2: Only colorize if user forces it ...
+ # 1: ... or we know less will handle raw codes -- this will
+ # not detect -seiRM, so set LESSCOLORIZER yourself
+ if [[ ${LESSCOLOR} == "2" ]] || [[ " ${LESS} " == *" -"[rR]" "* ]] ; then
${LESSCOLORIZER} "$1"
exit 0
fi
- # ... or we know less will handle raw codes
- for opt in ${LESS} ; do
- if [[ ${opt} == "-r" || ${opt} == "-R" ]] ; then
- ${LESSCOLORIZER} "$1"
- break
- fi
- done
;;
# May not be such a good idea :)
@@ -234,7 +229,7 @@ if [[ -z $1 ]] ; then
echo "Usage: lesspipe.sh <file>"
elif [[ $1 == "-V" || $1 == "--version" ]] ; then
Id="cvsid"
- cvsid="$Id: lesspipe.sh,v 1.33 2009/02/09 18:58:10 vapier Exp $"
+ cvsid="$Id: lesspipe.sh,v 1.34 2009/03/13 06:06:29 vapier Exp $"
cat <<-EOF
$cvsid
Copyright 2001-2009 Gentoo Foundation