Commit | Line | Data |
---|---|---|
7521b042 | 1 | #! /bin/csh -f |
059ac797 | 2 | # |
d0aeaf5a DF |
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 | # | |
7521b042 | 7 | # @(#)vgrind.sh 5.3 (Berkeley) %G% |
960da368 BJ |
8 | # |
9 | # vgrind | |
10 | # | |
96bba43e | 11 | set b=/usr/lib |
d86b02dd DP |
12 | set voptions= |
13 | set options= | |
14 | set files= | |
ad765208 | 15 | set f='' |
d86b02dd | 16 | set head="" |
960da368 | 17 | top: |
d86b02dd DP |
18 | if ($#argv > 0) then |
19 | switch ($1:q) | |
960da368 | 20 | |
d86b02dd DP |
21 | case -f: |
22 | set f='filter' | |
23 | set options = "$options $1:q" | |
24 | shift | |
25 | goto top | |
ad765208 | 26 | |
d86b02dd DP |
27 | case -t: |
28 | set voptions = "$voptions -t" | |
29 | shift | |
30 | goto top | |
960da368 | 31 | |
d86b02dd DP |
32 | case -o*: |
33 | set voptions="$voptions $1:q" | |
34 | shift | |
35 | goto top | |
ad765208 | 36 | |
d86b02dd DP |
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 | |
960da368 BJ |
74 | endif |
75 | if (-r index) then | |
d86b02dd DP |
76 | echo > nindex |
77 | foreach i ($files) | |
059ac797 KM |
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 | |
d86b02dd DP |
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 - | |
ad765208 | 86 | else |
d86b02dd | 87 | $b/vfontedpr $options $files | cat $b/tmac/tmac.vgrind - |
a6efa23a | 88 | endif |
d86b02dd DP |
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 | |
960da368 | 100 | else |
d86b02dd DP |
101 | if ($f == 'filter') then |
102 | if ("$head" != "") then | |
103 | $b/vfontedpr $options -h "$head" $files | cat $b/tmac/tmac.vgrind - | |
c30aee76 | 104 | else |
d86b02dd | 105 | $b/vfontedpr $options $files | cat $b/tmac/tmac.vgrind - |
a6efa23a | 106 | endif |
d86b02dd DP |
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 | |
960da368 | 116 | endif |
d86b02dd DP |
117 | |
118 | done: |