date and time created 83/02/11 15:44:43 by rrh
[unix-history] / usr / src / usr.bin / vgrind / vgrind.sh
CommitLineData
059ac797
KM
1#! /bin/csh
2#
3# @(#)vgrind.sh 1.8 (Berkeley) %G%
960da368
BJ
4#
5# vgrind
6#
96bba43e 7set b=/usr/lib
d86b02dd
DP
8set voptions=
9set options=
10set files=
ad765208 11set f=''
d86b02dd 12set head=""
960da368 13top:
d86b02dd
DP
14if ($#argv > 0) then
15 switch ($1:q)
960da368 16
d86b02dd
DP
17 case -f:
18 set f='filter'
19 set options = "$options $1:q"
20 shift
21 goto top
ad765208 22
d86b02dd
DP
23 case -t:
24 set voptions = "$voptions -t"
25 shift
26 goto top
960da368 27
d86b02dd
DP
28 case -o*:
29 set voptions="$voptions $1:q"
30 shift
31 goto top
ad765208 32
d86b02dd
DP
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
960da368
BJ
70endif
71if (-r index) then
d86b02dd
DP
72 echo > nindex
73 foreach i ($files)
059ac797
KM
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
d86b02dd
DP
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 -
ad765208 82 else
d86b02dd 83 $b/vfontedpr $options $files | cat $b/tmac/tmac.vgrind -
a6efa23a 84 endif
d86b02dd
DP
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
960da368 96else
d86b02dd
DP
97 if ($f == 'filter') then
98 if ("$head" != "") then
99 $b/vfontedpr $options -h "$head" $files | cat $b/tmac/tmac.vgrind -
c30aee76 100 else
d86b02dd 101 $b/vfontedpr $options $files | cat $b/tmac/tmac.vgrind -
a6efa23a 102 endif
d86b02dd
DP
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
960da368 112endif
d86b02dd
DP
113
114done: