1#!/bin/csh -f 2# 3# Copyright (c) 1980 The Regents of the University of California. 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms are permitted 7# provided that the above copyright notice and this paragraph are 8# duplicated in all such forms and that any documentation, 9# advertising materials, and other materials related to such 10# distribution and use acknowledge that the software was developed 11# by the University of California, Berkeley. The name of the 12# University may not be used to endorse or promote products derived 13# from this software without specific prior written permission. 14# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 15# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 16# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 17# 18# @(#)vgrind.sh 5.6 (Berkeley) 05/01/89 19# 20set voptions= 21set options= 22set files= 23set f='' 24set head="" 25set vf=/usr/libexec/vfontedpr 26set tm=/usr/share/tmac 27top: 28if ($#argv > 0) then 29 switch ($1:q) 30 31 case -f: 32 set f='filter' 33 set options = "$options $1:q" 34 shift 35 goto top 36 37 case -t: 38 set voptions = "$voptions -t" 39 shift 40 goto top 41 42 case -o*: 43 set voptions="$voptions $1:q" 44 shift 45 goto top 46 47 case -W: 48 set voptions = "$voptions -W" 49 shift 50 goto top 51 52 case -d: 53 if ($#argv < 2) then 54 echo "vgrind: $1:q option must have argument" 55 goto done 56 else 57 set options = ($options $1:q $2) 58 shift 59 shift 60 goto top 61 endif 62 63 case -h: 64 if ($#argv < 2) then 65 echo "vgrind: $1:q option must have argument" 66 goto done 67 else 68 set head="$2" 69 shift 70 shift 71 goto top 72 endif 73 74 case -*: 75 set options = "$options $1:q" 76 shift 77 goto top 78 79 default: 80 set files = "$files $1:q" 81 shift 82 goto top 83 endsw 84endif 85if (-r index) then 86 echo > nindex 87 foreach i ($files) 88 # make up a sed delete command for filenames 89 # being careful about slashes. 90 echo "? $i ?d" | sed -e "s:/:\\/:g" -e "s:?:/:g" >> nindex 91 end 92 sed -f nindex index >xindex 93 if ($f == 'filter') then 94 if ("$head" != "") then 95 $vf $options -h "$head" $files | cat $tm/tmac.vgrind - 96 else 97 $vf $options $files | cat $tm/tmac.vgrind - 98 endif 99 else 100 if ("$head" != "") then 101 $vf $options -h "$head" $files | \ 102 sh -c "vtroff -rx1 $voptions -i -mvgrind 2>> xindex" 103 else 104 $vf $options $files | \ 105 sh -c "vtroff -rx1 $voptions -i -mvgrind 2>> xindex" 106 endif 107 endif 108 sort -df +0 -2 xindex >index 109 rm nindex xindex 110else 111 if ($f == 'filter') then 112 if ("$head" != "") then 113 $vf $options -h "$head" $files | cat $tm/tmac.vgrind - 114 else 115 $vf $options $files | cat $tm/tmac.vgrind - 116 endif 117 else 118 if ("$head" != "") then 119 $vf $options -h "$head" $files | vtroff -i $voptions -mvgrind 120 else 121 $vf $options $files | vtroff -i $voptions -mvgrind 122 endif 123 endif 124endif 125 126done: 127