File: man2ps

package info (click to toggle)
ftnchek 2.11.2-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,392 kB
  • ctags: 2,790
  • sloc: ansic: 21,570; fortran: 2,921; yacc: 2,794; sh: 1,623; makefile: 693; lisp: 264; awk: 163
file content (49 lines) | stat: -rwxr-xr-x 1,250 bytes parent folder | download | duplicates (8)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
# Filter for converting "troff -mxx" to PostScript.  This script is
# normally linked to the names man2ps, ms2ps, me2ps, and mm2ps.
#
# Usage:
#	man2ps [<] cc.1   >cc.ps
#	me2ps  [<] foo.me >foo.ps
#	mm2ps  [<] foo.mm >foo.ps
#	ms2ps  [<] foo.ms >foo.ps
#
# [08-May-1993]

# Choose a troff format according to the scrip name.
case `basename $0` in
	man*)	FORMAT=-man ;;
	me*)	FORMAT=-me ;;
	mm*)	FORMAT=-mm ;;
	ms*)	FORMAT=-ms ;;
	*)	echo "Unknown troff format:" ; exit 1 ;;
esac

# We can use either GNU groff or Sun Solaris troff + dpost
# or IBM-AIX psroff
if [ -x /usr/local/bin/groff ]
then	# GNU groff
	TROFF="/usr/local/bin/groff $FORMAT"
	TROFF2PS="cat"
elif [ -x /usr/local/gnu/bin/groff ]
then	# GNU groff
	TROFF="/usr/local/gnu/bin/groff $FORMAT"
	TROFF2PS="cat"
elif [ -x /usr/bin/groff ]
then	# GNU groff
	TROFF="/usr/bin/groff $FORMAT"
	TROFF2PS="cat"
elif [ -x /usr/lib/lp/postscript/dpost ]
then	# Solaris 2.1
	TROFF="troff $FORMAT"
	TROFF2PS="/usr/lib/lp/postscript/dpost"
elif [ -x /bin/psroff -o -x /usr/bin/psroff -o -x /usr/local/bin/psroff ]
then	# IBM-AIX or local psroff
	TROFF="psroff -t $FORMAT"
	TROFF2PS="cat"
else
	echo "Cannot find troff-to-PostScript filter" >&2
	exit 1
fi

tbl $* | eqn | $TROFF | $TROFF2PS