diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-03-16 13:01:51 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2008-03-16 13:01:51 +0000 |
commit | 0d0b7e5e96be9ef81084a8b964fb555c7429b949 (patch) | |
tree | 8eac302d87c263e1c61d1a75d569ec351ff46b3d /sys-apps/less/files | |
parent | old (diff) | |
download | historical-0d0b7e5e96be9ef81084a8b964fb555c7429b949.tar.gz historical-0d0b7e5e96be9ef81084a8b964fb555c7429b949.tar.bz2 historical-0d0b7e5e96be9ef81084a8b964fb555c7429b949.zip |
Add case for shell scripts for file output #213565 by Matthias B.
Package-Manager: portage-2.2_pre2
Diffstat (limited to 'sys-apps/less/files')
-rw-r--r-- | sys-apps/less/files/lesspipe.sh | 28 |
1 files changed, 16 insertions, 12 deletions
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 |