add633f057
Tue Jun 18 2002 Karsten Hopp <karsten@redhat.de> 358-27 - added Kazushi (Jam) Marukawa ISO-2022 patch 254 to support multibyte characters - added Mike Fabians patch to fix bold/underlined non-ASCII characters in UTF-8 mode - finally added support for directories (#17456 and #62050) - re-enabled fallback if no charset could be found (#24463) - added Matt's fix for #26113 - show changelog and filelist when viewing a rpm package (#64900) Thu May 23 2002 Tim Powers <timp@redhat.com> - automated rebuild Thu Apr 25 2002 Than Ngo <than@redhat.com> 358-25 - add fix to handle tar.bz2 file
39 lines
928 B
Bash
Executable File
39 lines
928 B
Bash
Executable File
#!/bin/sh -
|
|
#
|
|
# To use this filter with less, define LESSOPEN:
|
|
# export LESSOPEN="|/usr/bin/lesspipe.sh %s"
|
|
|
|
lesspipe() {
|
|
case "$1" in
|
|
*.[1-9n]|*.man|*.[1-9n].bz2|*.man.bz2|*.[1-9].gz|*.[1-9]x.gz|*.[1-9].man.gz)
|
|
case "$1" in
|
|
*.gz) DECOMPRESSOR="gunzip -c" ;;
|
|
*.bz2) DECOMPRESSOR="bunzip2 -c" ;;
|
|
*) DECOMPRESSOR="cat" ;;
|
|
esac
|
|
if $DECOMPRESSOR -- "$1" | file - | grep -q troff; then
|
|
if echo "$1" | grep -q ^/; then #absolute path
|
|
man -- "$1" | cat -s
|
|
else
|
|
man -- "./$1" | cat -s
|
|
fi
|
|
else
|
|
$DECOMPRESSOR -- "$1"
|
|
fi ;;
|
|
*.tar) tar tvvf "$1" ;;
|
|
*.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1" ;;
|
|
*.tar.bz2|*.tbz2) bzip2 -dc "$1" | tar tvvf - ;;
|
|
*.[zZ]|*.gz) gzip -dc -- "$1" ;;
|
|
*.bz2) bzip2 -dc -- "$1" ;;
|
|
*.zip) zipinfo -- "$1" ;;
|
|
*.rpm) rpm -qpivl --changelog -- "$1" ;;
|
|
*.cpi|*.cpio) cpio -itv < "$1" ;;
|
|
esac
|
|
}
|
|
|
|
if [ -d "$1" ] ; then
|
|
/bin/ls -alF -- "$1"
|
|
else
|
|
lesspipe "$1" 2> /dev/null
|
|
fi
|