xref: /original-bsd/old/vpr/vtroff.sh (revision 6c57d260)
1#	@(#)vtroff.sh	1.2	01/08/81
2umask 0
3set flags=() noglob length=() fonts=() fontf=() macp=(/usr/lib/tmac/tmac.vcat)
4unset t
5top:
6	if ($#argv > 0) then
7		switch ($argv[1])
8
9		case -t:
10			set t
11			shift argv
12			goto top
13
14		case -l*:
15			set length = $argv[1]
16			shift argv
17			goto top
18
19		case -V:
20			unset wide
21			shift argv
22			goto top
23
24		case -W:
25			set wide
26			shift argv
27			goto top
28
29		case -F:
30			if ($#argv < 2) then
31				echo -F takes following font name.
32				exit(1)
33			endif
34			set argv=(-1 $2.r -2 $2.i -3 $2.b $argv[3-])
35			goto top
36
37		case -1:
38		case -2:
39		case -3:
40			if ($#argv < 2) then
41				echo $1 takes following font name.
42				exit(1)
43			endif
44			if (! -r /usr/lib/fontinfo/$2) then
45				if (! -r /usr/lib/fontinfo/$2.r) then
46					echo ${2}: font not found.
47					exit(1)
48				endif
49				set argv[2] = $2.r
50			endif
51			if ($#fonts == 0) then
52				set fontf=/usr/tmp/fnt$$
53				cp /dev/null $fontf
54			endif
55			@ fnum = 0 - $1
56			echo .nr p $fnum >> $fontf
57			cat /usr/lib/fontinfo/$2 >> $fontf
58			set fonts=($fonts $1 $2)
59			shift argv
60			shift argv
61			goto top
62
63		case -x:
64			set macp=()
65			shift argv
66			goto top
67
68		case -*:
69			set flags = ($flags $argv[1])
70			shift argv
71			goto top
72
73		endsw
74	endif
75if ($#argv == 0) then
76	set argv=(-)
77endif
78if ($?wide) then
79    if ($?t) then
80	/usr/bin/troff -t -rv1 $flags $macp $fontf $* | /usr/lib/vsort -W $length
81    else
82	/usr/bin/troff -t -rv1 $flags $macp $fontf $* | \
83	    /usr/lib/vsort -W $length | /usr/ucb/vpr -W -t $fonts
84    endif
85else
86    if ($?t) then
87	/usr/bin/troff -t -rv1 $flags $macp $fontf $* | /usr/lib/rvsort $length
88    else
89	/usr/bin/troff -t -rv1 $flags $macp $fontf $* | \
90	    /usr/lib/rvsort $length | /usr/ucb/vpr -t $fonts
91#	    /usr/lib/vsort -c $length | /usr/ucb/vpr -t $fonts
92    endif
93endif
94if ($#fontf) then
95	rm $fontf
96endif
97