| 1 | #! /bin/csh |
| 2 | # |
| 3 | # @(#)vgrind.sh 1.8 (Berkeley) %G% |
| 4 | # |
| 5 | # vgrind |
| 6 | # |
| 7 | set b=/usr/lib |
| 8 | set voptions= |
| 9 | set options= |
| 10 | set files= |
| 11 | set f='' |
| 12 | set head="" |
| 13 | top: |
| 14 | if ($#argv > 0) then |
| 15 | switch ($1:q) |
| 16 | |
| 17 | case -f: |
| 18 | set f='filter' |
| 19 | set options = "$options $1:q" |
| 20 | shift |
| 21 | goto top |
| 22 | |
| 23 | case -t: |
| 24 | set voptions = "$voptions -t" |
| 25 | shift |
| 26 | goto top |
| 27 | |
| 28 | case -o*: |
| 29 | set voptions="$voptions $1:q" |
| 30 | shift |
| 31 | goto top |
| 32 | |
| 33 | case -W: |
| 34 | set voptions = "$voptions -W" |
| 35 | shift |
| 36 | goto top |
| 37 | |
| 38 | case -d: |
| 39 | if ($#argv < 2) then |
| 40 | echo "vgrind: $1:q option must have argument" |
| 41 | goto done |
| 42 | else |
| 43 | set options = ($options $1:q $2) |
| 44 | shift |
| 45 | shift |
| 46 | goto top |
| 47 | endif |
| 48 | |
| 49 | case -h: |
| 50 | if ($#argv < 2) then |
| 51 | echo "vgrind: $1:q option must have argument" |
| 52 | goto done |
| 53 | else |
| 54 | set head="$2" |
| 55 | shift |
| 56 | shift |
| 57 | goto top |
| 58 | endif |
| 59 | |
| 60 | case -*: |
| 61 | set options = "$options $1:q" |
| 62 | shift |
| 63 | goto top |
| 64 | |
| 65 | default: |
| 66 | set files = "$files $1:q" |
| 67 | shift |
| 68 | goto top |
| 69 | endsw |
| 70 | endif |
| 71 | if (-r index) then |
| 72 | echo > nindex |
| 73 | foreach i ($files) |
| 74 | # make up a sed delete command for filenames |
| 75 | # being careful about slashes. |
| 76 | echo "? $i ?d" | sed -e "s:/:\\/:g" -e "s:?:/:g" >> nindex |
| 77 | end |
| 78 | sed -f nindex index >xindex |
| 79 | if ($f == 'filter') then |
| 80 | if ("$head" != "") then |
| 81 | $b/vfontedpr $options -h "$head" $files | cat $b/tmac/tmac.vgrind - |
| 82 | else |
| 83 | $b/vfontedpr $options $files | cat $b/tmac/tmac.vgrind - |
| 84 | endif |
| 85 | else |
| 86 | if ("$head" != "") then |
| 87 | $b/vfontedpr $options -h "$head" $files | \ |
| 88 | /bin/sh -c "vtroff -rx1 $voptions -i -mvgrind 2>> xindex" |
| 89 | else |
| 90 | $b/vfontedpr $options $files | \ |
| 91 | /bin/sh -c "vtroff -rx1 $voptions -i -mvgrind 2>> xindex" |
| 92 | endif |
| 93 | endif |
| 94 | sort -df +0 -2 xindex >index |
| 95 | rm nindex xindex |
| 96 | else |
| 97 | if ($f == 'filter') then |
| 98 | if ("$head" != "") then |
| 99 | $b/vfontedpr $options -h "$head" $files | cat $b/tmac/tmac.vgrind - |
| 100 | else |
| 101 | $b/vfontedpr $options $files | cat $b/tmac/tmac.vgrind - |
| 102 | endif |
| 103 | else |
| 104 | if ("$head" != "") then |
| 105 | $b/vfontedpr $options -h "$head" $files \ |
| 106 | | vtroff -i $voptions -mvgrind |
| 107 | else |
| 108 | $b/vfontedpr $options $files \ |
| 109 | | vtroff -i $voptions -mvgrind |
| 110 | endif |
| 111 | endif |
| 112 | endif |
| 113 | |
| 114 | done: |