summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-03-16 13:01:51 +0000
committerMike Frysinger <vapier@gentoo.org>2008-03-16 13:01:51 +0000
commit2f05137bb1b32ff9f8853a79417686d4402d2c75 (patch)
tree7931a100be07be9fea811c649b5b04ebe055a900 /sys-apps/less
parentold (diff)
downloadgentoo-2-2f05137bb1b32ff9f8853a79417686d4402d2c75.tar.gz
gentoo-2-2f05137bb1b32ff9f8853a79417686d4402d2c75.tar.bz2
gentoo-2-2f05137bb1b32ff9f8853a79417686d4402d2c75.zip
Add case for shell scripts for file output #213565 by Matthias B.
(Portage version: 2.2_pre2)
Diffstat (limited to 'sys-apps/less')
-rw-r--r--sys-apps/less/ChangeLog5
-rw-r--r--sys-apps/less/files/lesspipe.sh28
2 files changed, 20 insertions, 13 deletions
diff --git a/sys-apps/less/ChangeLog b/sys-apps/less/ChangeLog
index e5ca736cad97..e038cc72fc8e 100644
--- a/sys-apps/less/ChangeLog
+++ b/sys-apps/less/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for sys-apps/less
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/less/ChangeLog,v 1.92 2008/02/21 00:55:25 ranger Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/less/ChangeLog,v 1.93 2008/03/16 13:01:51 vapier Exp $
+
+ 16 Mar 2008; Mike Frysinger <vapier@gentoo.org> files/lesspipe.sh:
+ Add case for shell scripts for file output #213565 by Matthias B.
21 Feb 2008; Brent Baude <ranger@gentoo.org> less-418.ebuild:
stable ppc64, bug 210725
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
index da80eed77264..c399c50b4113 100644
--- a/sys-apps/less/files/lesspipe.sh
+++ b/sys-apps/less/files/lesspipe.sh
@@ -19,19 +19,22 @@ guesscompress() {
lesspipe_file() {
local out=$(file -L -- "$1")
+ local suffix
case ${out} in
- *" ar archive"*) lesspipe "$1" ".a" ;;
- *" tar archive"*) lesspipe "$1" ".tar" ;;
- *" CAB-Installer"*) lesspipe "$1" ".cab" ;;
- *" troff "*) lesspipe "$1" ".man" ;;
- *" shared object"*) lesspipe "$1" ".so" ;;
- *" Zip archive"*) lesspipe "$1" ".zip" ;;
- *" LHa"*archive*) lesspipe "$1" ".lha" ;;
- *" cpio archive"*) lesspipe "$1" ".cpio" ;;
- *" ELF "*) readelf -a -- "$1" ;;
- *": data") hexdump -C -- "$1" ;;
- *) return 1 ;;
+ *" ar archive"*) suffix="a";;
+ *" CAB-Installer"*) suffix="cab";;
+ *" cpio archive"*) suffix="cpio";;
+ *" ELF "*) suffix="elf";;
+ *" LHa"*archive*) suffix="lha";;
+ *" troff "*) suffix="man";;
+ *" script text"*) suffix="sh";;
+ *" shared object"*) suffix="so";;
+ *" tar archive"*) suffix="tar";;
+ *" Zip archive"*) suffix="zip";;
+ *": data") hexdump -C -- "$1"; return 0;;
+ *) return 1;;
esac
+ lesspipe "$1" ".${suffix}"
return 0
}
@@ -105,6 +108,7 @@ lesspipe() {
*.zoo) zoo -list "$1" ;;
*.7z) 7z l -- "$1" ;;
*.a) ar tv "$1" ;;
+ *.elf) readelf -a -- "$1" ;;
*.so) readelf -h -d -s -- "$1" ;;
*.mo|*.gmo) msgunfmt -- "$1" ;;
@@ -199,7 +203,7 @@ if [[ -z $1 ]] ; then
echo "Usage: lesspipe.sh <file>"
elif [[ $1 == "-V" ]] ; then
Id="cvsid"
- cvsid="$Id: lesspipe.sh,v 1.26 2007/11/06 02:19:29 vapier Exp $"
+ cvsid="$Id: lesspipe.sh,v 1.27 2008/03/16 13:01:51 vapier Exp $"
cat <<-EOF
$cvsid
Copyright 2001-2006 Gentoo Foundation