| 1 | #! /bin/csh -f |
| 2 | # |
| 3 | # @(#)vtroff.sh 4.3 (Berkeley) %G% |
| 4 | # |
| 5 | umask 0 |
| 6 | set flags=() noglob length=() fonts=() fontf=() |
| 7 | unset t |
| 8 | set macp = (/usr/lib/tmac/tmac.vcat) |
| 9 | set sort = (/usr/lib/rvsort) |
| 10 | set lpr = (/usr/ucb/lpr -Pvarian) |
| 11 | top: |
| 12 | if ($#argv > 0) then |
| 13 | switch ($argv[1]) |
| 14 | case -t: |
| 15 | set t |
| 16 | shift argv |
| 17 | goto top |
| 18 | case -l*: |
| 19 | set length = $argv[1] |
| 20 | shift argv |
| 21 | goto top |
| 22 | case -V: |
| 23 | set sort = (/usr/lib/rvsort) |
| 24 | set lpr = (/usr/ucb/lpr -Pvarian) |
| 25 | shift argv |
| 26 | goto top |
| 27 | case -W: |
| 28 | set sort = (/usr/lib/vsort -W) |
| 29 | set lpr = (/usr/ucb/lpr -Pversatec) |
| 30 | shift argv |
| 31 | goto top |
| 32 | case -F: |
| 33 | if ($#argv < 2) then |
| 34 | echo -F takes following font name. |
| 35 | exit(1) |
| 36 | endif |
| 37 | set argv=(-1 $2.r -2 $2.i -3 $2.b $argv[3-]) |
| 38 | goto top |
| 39 | case -1: |
| 40 | case -2: |
| 41 | case -3: |
| 42 | if ($#argv < 2) then |
| 43 | echo $1 takes following font name. |
| 44 | exit(1) |
| 45 | endif |
| 46 | if (! -r /usr/lib/fontinfo/$2) then |
| 47 | if (! -r /usr/lib/fontinfo/$2.r) then |
| 48 | echo ${2}: font not found. |
| 49 | exit(1) |
| 50 | endif |
| 51 | set argv[2] = $2.r |
| 52 | endif |
| 53 | if ($#fonts == 0) then |
| 54 | set fontf=/usr/tmp/fnt$$ |
| 55 | cp /dev/null $fontf |
| 56 | endif |
| 57 | @ fnum = 0 - $1 |
| 58 | echo .nr p $fnum >> $fontf |
| 59 | cat /usr/lib/fontinfo/$2 >> $fontf |
| 60 | set fonts=($fonts $1 $2) |
| 61 | shift argv |
| 62 | shift argv |
| 63 | goto top |
| 64 | case -x: |
| 65 | set macp=() |
| 66 | shift argv |
| 67 | goto top |
| 68 | case -*: |
| 69 | set flags = ($flags $argv[1]) |
| 70 | shift argv |
| 71 | goto top |
| 72 | case -: |
| 73 | breaksw |
| 74 | endsw |
| 75 | endif |
| 76 | if ($#argv == 0) then |
| 77 | set argv=(-) |
| 78 | set banner=vtroff |
| 79 | else |
| 80 | set banner=$argv[1] |
| 81 | endif |
| 82 | if ($?t) then |
| 83 | /usr/bin/troff -t -rv1 $flags $macp $fontf $* | $sort $length |
| 84 | else |
| 85 | /usr/bin/troff -t -rv1 $flags $macp $fontf $* | $sort $length |\ |
| 86 | $lpr -J$banner -t $fonts |
| 87 | endif |
| 88 | if ($#fontf) then |
| 89 | /bin/rm $fontf |
| 90 | endif |