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