took out debugging `set echo'.
[unix-history] / usr / src / old / vpr / vtroff.sh
CommitLineData
4ff0f423 1#! /bin/csh -f
87707547 2#
9e3e4926 3# @(#)vtroff.sh 1.6 (Berkeley) %G%
87707547 4#
3cd3a239
PK
5# $troffmachine is where the troffing will be done.
6set troffmachine = ucbdali
7#
8# if the troff machine is not the local machine and it is up,
9# use it otherwise troff (and sort) locally.
10if ($troffmachine != `hostname` && \
11 `ruptime | grep -c "$troffmachine.*up"` == 1) then
12 set troffsh = ( /usr/ucb/rsh $troffmachine )
87707547 13else
3cd3a239 14 set troffsh = ( /bin/sh -c )
87707547 15endif
7dff0e2e 16umask 0
3cd3a239 17set flags=() noglob length=() fonts=() fontf=()
7dff0e2e 18unset t
3cd3a239
PK
19set macp = (/usr/lib/tmac/tmac.vcat)
20set sort = (/usr/lib/rvsort)
21set vpr = (/usr/ucb/vpr)
7dff0e2e
BJ
22top:
23 if ($#argv > 0) then
24 switch ($argv[1])
7dff0e2e
BJ
25 case -t:
26 set t
27 shift argv
28 goto top
7dff0e2e
BJ
29 case -l*:
30 set length = $argv[1]
31 shift argv
32 goto top
7dff0e2e 33 case -V:
3cd3a239
PK
34 set sort = (/usr/lib/rvsort)
35 set vpr = (/usr/ucb/vpr)
7dff0e2e
BJ
36 shift argv
37 goto top
7dff0e2e 38 case -W:
3cd3a239
PK
39 set sort = (/usr/lib/vsort -W)
40 set vpr = (/usr/ucb/vpr -W)
7dff0e2e
BJ
41 shift argv
42 goto top
7dff0e2e
BJ
43 case -F:
44 if ($#argv < 2) then
45 echo -F takes following font name.
46 exit(1)
47 endif
48 set argv=(-1 $2.r -2 $2.i -3 $2.b $argv[3-])
49 goto top
7dff0e2e
BJ
50 case -1:
51 case -2:
52 case -3:
53 if ($#argv < 2) then
54 echo $1 takes following font name.
55 exit(1)
56 endif
57 if (! -r /usr/lib/fontinfo/$2) then
58 if (! -r /usr/lib/fontinfo/$2.r) then
59 echo ${2}: font not found.
60 exit(1)
61 endif
62 set argv[2] = $2.r
63 endif
64 if ($#fonts == 0) then
65 set fontf=/usr/tmp/fnt$$
66 cp /dev/null $fontf
67 endif
68 @ fnum = 0 - $1
69 echo .nr p $fnum >> $fontf
70 cat /usr/lib/fontinfo/$2 >> $fontf
71 set fonts=($fonts $1 $2)
72 shift argv
73 shift argv
74 goto top
7dff0e2e
BJ
75 case -x:
76 set macp=()
77 shift argv
78 goto top
7dff0e2e
BJ
79 case -*:
80 set flags = ($flags $argv[1])
81 shift argv
82 goto top
7dff0e2e
BJ
83 endsw
84 endif
85if ($#argv == 0) then
86 set argv=(-)
87endif
3cd3a239
PK
88if ($?t) then
89 /usr/ucb/soelim $macp $fontf $argv[*] \
90 | $troffsh "/usr/bin/troff -t -rv1 $flags | $sort $length"
7dff0e2e 91else
3cd3a239
PK
92 /usr/ucb/soelim $macp $fontf $argv[*] \
93 | $troffsh "/usr/bin/troff -t -rv1 $flags | $sort $length | $vpr -t $fonts"
7dff0e2e
BJ
94endif
95if ($#fontf) then
3cd3a239 96 /bin/rm $fontf
7dff0e2e 97endif