- Add support for *.xz and *.lzma man pages

Split case for compressed and plain troff files

Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
This commit is contained in:
Vojtech Vitek (V-Teq) 2011-02-14 22:20:13 +01:00 committed by Vojtech Vitek (V-Teq)
parent 674b3188a8
commit f197286adf
2 changed files with 18 additions and 19 deletions

View File

@ -71,6 +71,9 @@ ls -la $RPM_BUILD_ROOT/etc/profile.d
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%changelog %changelog
- Split case for compressed and plain troff files
- Add support for *.xz and *.lzma man pages
Resolves: #676057
- Add support for reading UTF-16 and UTF-32 files - Add support for reading UTF-16 and UTF-32 files
Resolves: #638312 Resolves: #638312
- Don't require correct exit status from LESSOPEN scripts until - Don't require correct exit status from LESSOPEN scripts until

View File

@ -13,32 +13,28 @@
lesspipe() { lesspipe() {
case "$1" in case "$1" in
*.[1-9n]|*.man|*.[1-9n].bz2|*.man.bz2|*.[1-9].gz|*.[1-9]x.gz|*.man.gz|*.[1-9].xz|*.[1-9]x.xz|*.man.xz) *.[1-9n].bz2|*.[1-9]x.bz2|*.man.bz2|*.[1-9n].[gx]z|*.[1-9]x.[gx]z|*.man.[gx]z|*.[1-9n].lzma|*.[1-9]x.lzma|*.man.lzma)
case "$1" in case "$1" in
*.gz) DECOMPRESSOR="gzip -dc" ;; *.gz) DECOMPRESSOR="gzip -dc" ;;
*.bz2) DECOMPRESSOR="bzip2 -dc" ;; *.bz2) DECOMPRESSOR="bzip2 -dc" ;;
*.xz|*.lzma) DECOMPRESSOR="xz -dc" ;;
esac esac
if [ ! -z "$DECOMPRESSOR" ] ; then if [ -n "$DECOMPRESSOR" ] && $DECOMPRESSOR -- "$1" | file - | grep -q troff; then
if $DECOMPRESSOR -- "$1" | file - | grep -q troff; then $DECOMPRESSOR -- "$1" | man -l - | cat -s
if echo "$1" | grep -q ^/; then #absolute path exit $?
man -- "$1" | cat -s fi ;;&
else *.[1-9n]|*.[1-9]x|*.man)
man -- "./$1" | cat -s if file "$1" | grep -q troff; then
fi man -l "$1" | cat -s
else exit $?
$DECOMPRESSOR -- "$1" fi ;;&
fi
else
exit 1
fi ;;
*.tar) tar tvvf "$1" ;; *.tar) tar tvvf "$1" ;;
*.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1" ;; *.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1" ;;
*.tar.xz) tar Jtvvf "$1" ;; *.tar.xz) tar Jtvvf "$1" ;;
*.xz) xz -dc -- "$1" ;; *.xz|*.lzma) xz -dc -- "$1" ;;
*.tar.bz2|*.tbz2) bzip2 -dc -- "$1" | tar tvvf - ;; *.tar.bz2|*.tbz2) bzip2 -dc -- "$1" | tar tvvf - ;;
*.[zZ]|*.gz) gzip -dc -- "$1" ;; *.[zZ]|*.gz) gzip -dc -- "$1" ;;
*.bz2) bzip2 -dc -- "$1" ;; *.bz2) bzip2 -dc -- "$1" ;;
*.lzma) lzma -c -d -- "$1" ;;
*.zip|*.jar|*.nbm) zipinfo -- "$1" ;; *.zip|*.jar|*.nbm) zipinfo -- "$1" ;;
*.rpm) rpm -qpivl --changelog -- "$1" ;; *.rpm) rpm -qpivl --changelog -- "$1" ;;
*.cpi|*.cpio) cpio -itv < "$1" ;; *.cpi|*.cpio) cpio -itv < "$1" ;;