date and time created 82/10/19 00:52:04 by mckusick
[unix-history] / usr / src / usr.bin / vgrind / vgrind.sh
CommitLineData
960da368
BJ
1#
2# vgrind
3#
96bba43e 4set b=/usr/lib
d86b02dd
DP
5set voptions=
6set options=
7set files=
ad765208 8set f=''
d86b02dd 9set head=""
960da368 10top:
d86b02dd
DP
11if ($#argv > 0) then
12 switch ($1:q)
960da368 13
d86b02dd
DP
14 case -f:
15 set f='filter'
16 set options = "$options $1:q"
17 shift
18 goto top
ad765208 19
d86b02dd
DP
20 case -t:
21 set voptions = "$voptions -t"
22 shift
23 goto top
960da368 24
d86b02dd
DP
25 case -o*:
26 set voptions="$voptions $1:q"
27 shift
28 goto top
ad765208 29
d86b02dd
DP
30 case -W:
31 set voptions = "$voptions -W"
32 shift
33 goto top
34
35 case -d:
36 if ($#argv < 2) then
37 echo "vgrind: $1:q option must have argument"
38 goto done
39 else
40 set options = ($options $1:q $2)
41 shift
42 shift
43 goto top
44 endif
45
46 case -h:
47 if ($#argv < 2) then
48 echo "vgrind: $1:q option must have argument"
49 goto done
50 else
51 set head="$2"
52 shift
53 shift
54 goto top
55 endif
56
57 case -*:
58 set options = "$options $1:q"
59 shift
60 goto top
61
62 default:
63 set files = "$files $1:q"
64 shift
65 goto top
66 endsw
960da368
BJ
67endif
68if (-r index) then
d86b02dd
DP
69 echo > nindex
70 foreach i ($files)
71 echo "/ $i /d" >> nindex
72 end
73 sed -f nindex index >xindex
74 if ($f == 'filter') then
75 if ("$head" != "") then
76 $b/vfontedpr $options -h "$head" $files | cat $b/tmac/tmac.vgrind -
ad765208 77 else
d86b02dd 78 $b/vfontedpr $options $files | cat $b/tmac/tmac.vgrind -
a6efa23a 79 endif
d86b02dd
DP
80 else
81 if ("$head" != "") then
82 $b/vfontedpr $options -h "$head" $files | \
83 /bin/sh -c "vtroff -rx1 $voptions -i -mvgrind 2>> xindex"
84 else
85 $b/vfontedpr $options $files | \
86 /bin/sh -c "vtroff -rx1 $voptions -i -mvgrind 2>> xindex"
87 endif
88 endif
89 sort -df +0 -2 xindex >index
90 rm nindex xindex
960da368 91else
d86b02dd
DP
92 if ($f == 'filter') then
93 if ("$head" != "") then
94 $b/vfontedpr $options -h "$head" $files | cat $b/tmac/tmac.vgrind -
c30aee76 95 else
d86b02dd 96 $b/vfontedpr $options $files | cat $b/tmac/tmac.vgrind -
a6efa23a 97 endif
d86b02dd
DP
98 else
99 if ("$head" != "") then
100 $b/vfontedpr $options -h "$head" $files \
101 | vtroff -i $voptions -mvgrind
102 else
103 $b/vfontedpr $options $files \
104 | vtroff -i $voptions -mvgrind
105 endif
106 endif
960da368 107endif
d86b02dd
DP
108
109done: