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