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