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