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