1#! /bin/csh -f 2# 3# @(#)vtroff.sh 4.5 (Berkeley) 06/02/90 4# 5umask 0 6set flags=() noglob length=() fonts=() fontf=() 7unset t 8set macp = (/usr/share/tmac/tmac.vcat) 9set sort = (/usr/libexec/rvsort) 10set lpr = (/usr/bin/lpr -Pvarian) 11set troff = (/usr/bin/troff) 12top: 13 if ($#argv > 0) then 14 switch ($argv[1]) 15 case -t: 16 set t 17 shift argv 18 goto top 19 case -l*: 20 set length = $argv[1] 21 shift argv 22 goto top 23 case -V: 24 set sort = (/usr/libexec/rvsort) 25 set lpr = (/usr/bin/lpr -Pvarian) 26 shift argv 27 goto top 28 case -W: 29 set sort = (/usr/libexec/vsort -W) 30 set lpr = (/usr/bin/lpr -Pversatec) 31 shift argv 32 goto top 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 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 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 74 case -x: 75 set macp=() 76 shift argv 77 goto top 78 case -*: 79 set flags = ($flags $argv[1]) 80 shift argv 81 goto top 82 case -: 83 breaksw 84 endsw 85 endif 86 87if ($#argv == 0) then 88 set argv=(-) 89 set banner=vtroff 90else 91 set banner=$argv[1] 92endif 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 106else 107 if ($?t) then 108 $troff $tflags $* | $sort $length 109 else 110 $troff $tflags $* | $sort $length | $lpr -J$banner -t $fonts 111 endif 112endif 113 114if ($#fontf) then 115 /bin/rm $fontf 116endif 117