diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-01-20 03:26:14 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-01-20 03:26:14 +0000 |
commit | ee71daad96a70fad8ac7dae87a17d51900e527a2 (patch) | |
tree | 8200e903f3fa091095c4e4c6c9a0c3d1ed8f8fea /sys-apps/less/files/lesspipe.sh | |
parent | Deprecated (diff) | |
download | gentoo-2-ee71daad96a70fad8ac7dae87a17d51900e527a2.tar.gz gentoo-2-ee71daad96a70fad8ac7dae87a17d51900e527a2.tar.bz2 gentoo-2-ee71daad96a70fad8ac7dae87a17d51900e527a2.zip |
allow files matching a `file` string to fall back to colorization if there are no shell script matches #351426 by Raphaël Vinot
(Portage version: 2.2.0_alpha13/cvs/Linux x86_64)
Diffstat (limited to 'sys-apps/less/files/lesspipe.sh')
-rw-r--r-- | sys-apps/less/files/lesspipe.sh | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh index 8bbf67678262..b656e3067f2e 100644 --- a/sys-apps/less/files/lesspipe.sh +++ b/sys-apps/less/files/lesspipe.sh @@ -188,19 +188,13 @@ lesspipe() { ### Everything else ### *) - # Sanity check - [[ ${recur} == 2 ]] && exit 0 + case $(( recur++ )) in + # Maybe we didn't match due to case issues ... + 0) lesspipe "$1" "$(echo $1 | LC_ALL=C tr '[:upper:]' '[:lower:]')" ;; - # Maybe we didn't match due to case issues ... - if [[ ${recur} == 0 ]] ; then - recur=1 - lesspipe "$1" "$(echo $1 | LC_ALL=C tr '[:upper:]' '[:lower:]')" - - # Maybe we didn't match because the file is named weird ... - else - recur=2 - lesspipe_file "$1" - fi + # Maybe we didn't match because the file is named weird ... + 1) lesspipe_file "$1" ;; + esac # So no matches from above ... finally fall back to an external # coloring package. No matching here so we don't have to worry @@ -235,7 +229,7 @@ if [[ -z $1 ]] ; then elif [[ $1 == "-V" || $1 == "--version" ]] ; then Id="cvsid" cat <<-EOF - $Id: lesspipe.sh,v 1.44 2011/01/18 20:26:13 vapier Exp $ + $Id: lesspipe.sh,v 1.45 2011/01/20 03:26:14 vapier Exp $ Copyright 2001-2010 Gentoo Foundation Mike Frysinger <vapier@gentoo.org> (with plenty of ideas stolen from other projects/distros) |