add man page, cleanup
[unix-history] / usr / src / old / vpr / vtroff.sh
CommitLineData
4ff0f423 1#! /bin/csh -f
87707547 2#
1171c4fa 3# @(#)vtroff.sh 4.5 (Berkeley) %G%
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)
82529f9f 11set troff = (/usr/bin/troff)
7dff0e2e
BJ
12top:
13 if ($#argv > 0) then
14 switch ($argv[1])
7dff0e2e
BJ
15 case -t:
16 set t
17 shift argv
18 goto top
7dff0e2e
BJ
19 case -l*:
20 set length = $argv[1]
21 shift argv
22 goto top
7dff0e2e 23 case -V:
3cd3a239 24 set sort = (/usr/lib/rvsort)
c0c17bfd 25 set lpr = (/usr/ucb/lpr -Pvarian)
7dff0e2e
BJ
26 shift argv
27 goto top
7dff0e2e 28 case -W:
3cd3a239 29 set sort = (/usr/lib/vsort -W)
c0c17bfd 30 set lpr = (/usr/ucb/lpr -Pversatec)
7dff0e2e
BJ
31 shift argv
32 goto top
82529f9f
RC
33 case -h:
34 if ($#argv < 2) then
35 echo -h takes following host name.
36 exit(1)
37 endif
38 set host = $argv[2]
39 shift argv
40 shift argv
41 goto top
7dff0e2e
BJ
42 case -F:
43 if ($#argv < 2) then
44 echo -F takes following font name.
45 exit(1)
46 endif
47 set argv=(-1 $2.r -2 $2.i -3 $2.b $argv[3-])
48 goto top
7dff0e2e
BJ
49 case -1:
50 case -2:
51 case -3:
52 if ($#argv < 2) then
53 echo $1 takes following font name.
54 exit(1)
55 endif
56 if (! -r /usr/lib/fontinfo/$2) then
57 if (! -r /usr/lib/fontinfo/$2.r) then
58 echo ${2}: font not found.
59 exit(1)
60 endif
61 set argv[2] = $2.r
62 endif
63 if ($#fonts == 0) then
64 set fontf=/usr/tmp/fnt$$
65 cp /dev/null $fontf
66 endif
67 @ fnum = 0 - $1
68 echo .nr p $fnum >> $fontf
69 cat /usr/lib/fontinfo/$2 >> $fontf
70 set fonts=($fonts $1 $2)
71 shift argv
72 shift argv
73 goto top
7dff0e2e
BJ
74 case -x:
75 set macp=()
76 shift argv
77 goto top
7dff0e2e
BJ
78 case -*:
79 set flags = ($flags $argv[1])
80 shift argv
81 goto top
561d1698
RC
82 case -:
83 breaksw
7dff0e2e
BJ
84 endsw
85 endif
82529f9f 86
7dff0e2e
BJ
87if ($#argv == 0) then
88 set argv=(-)
33be5ffe
RC
89 set banner=vtroff
90else
91 set banner=$argv[1]
7dff0e2e 92endif
82529f9f
RC
93
94set tflags=(-t -rv1 $flags $macp $fontf)
95
96if ($?host) then
97 if ($#fontf) then
98 echo vtroff -h does not support changing fonts -- run vtroff locally
99 exit(1)
100 endif
101 if ($?t) then
102 soelim $* | rsh $host \"$troff $tflags - | $sort $length\"
103 else
104 soelim $* | rsh $host \"$troff $tflags - | $sort $length | $lpr -J$banner -t $fonts\"
105 endif
7dff0e2e 106else
82529f9f
RC
107 if ($?t) then
108 $troff $tflags $* | $sort $length
109 else
110 $troff $tflags $* | $sort $length | $lpr -J$banner -t $fonts
111 endif
7dff0e2e 112endif
82529f9f 113
7dff0e2e 114if ($#fontf) then
33be5ffe 115 /bin/rm $fontf
7dff0e2e 116endif