diff options
Diffstat (limited to 'less/filter')
-rwxr-xr-x | less/filter | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/less/filter b/less/filter new file mode 100755 index 0000000..ac7b52f --- /dev/null +++ b/less/filter @@ -0,0 +1,25 @@ +#!/bin/sh +# +# /usr/lib/less/filter: less(1) filter +# +# To use: export LESSOPEN="|/usr/lib/less/filter %s" +# + +filter() { + case "$1" in + *.[1-9n]) cat "$1" | nroff -c -mandoc | cat -s ;; + *.[1-9n].gz) zcat "$1" | nroff -c -mandoc | cat -s ;; + *.[1-9n].bz2) bzcat "$1" | nroff -c -mandoc | cat -s ;; + *.tar) tar tvvf "$1" ;; + *.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1" ;; + *.tbz2|*.tar.bz2) tar tjvvf "$1" ;; + *.[zZ]|*.gz) gzip -dc "$1" ;; + *.bz2) bzip2 -dc "$1" ;; + *.zip) zipinfo "$1" ;; + *.cpio) cpio -itv < "$1" ;; + esac +} + +filter "$1" 2> /dev/null + +# End of file |