summaryrefslogtreecommitdiffstats
path: root/less/filter
blob: ac7b52f10e30b13e917a036587196384258bb599 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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