1#! /bin/csh -f 2# 3# @(#)vtroff.sh 1.6 (Berkeley) 11/23/82 4# 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 ) 13else 14 set troffsh = ( /bin/sh -c ) 15endif 16umask 0 17set flags=() noglob length=() fonts=() fontf=() 18unset t 19set macp = (/usr/lib/tmac/tmac.vcat) 20set sort = (/usr/lib/rvsort) 21set vpr = (/usr/ucb/vpr) 22top: 23 if ($#argv > 0) then 24 switch ($argv[1]) 25 case -t: 26 set t 27 shift argv 28 goto top 29 case -l*: 30 set length = $argv[1] 31 shift argv 32 goto top 33 case -V: 34 set sort = (/usr/lib/rvsort) 35 set vpr = (/usr/ucb/vpr) 36 shift argv 37 goto top 38 case -W: 39 set sort = (/usr/lib/vsort -W) 40 set vpr = (/usr/ucb/vpr -W) 41 shift argv 42 goto top 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 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 75 case -x: 76 set macp=() 77 shift argv 78 goto top 79 case -*: 80 set flags = ($flags $argv[1]) 81 shift argv 82 goto top 83 endsw 84 endif 85if ($#argv == 0) then 86 set argv=(-) 87endif 88if ($?t) then 89 /usr/ucb/soelim $macp $fontf $argv[*] \ 90 | $troffsh "/usr/bin/troff -t -rv1 $flags | $sort $length" 91else 92 /usr/ucb/soelim $macp $fontf $argv[*] \ 93 | $troffsh "/usr/bin/troff -t -rv1 $flags | $sort $length | $vpr -t $fonts" 94endif 95if ($#fontf) then 96 /bin/rm $fontf 97endif 98