Skip to content

Commit 2e62533

Browse files
authored
Merge pull request #2 from rfritz/ereturns
pprint, vgrind - return non-zero exit status in more cases. Document.
2 parents ad426ab + a1cd8c9 commit 2e62533

4 files changed

Lines changed: 28 additions & 2 deletions

File tree

pprint.1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ specifies a point size
146146
to use on output (exactly the same as the argument
147147
of a .ps)
148148
.El
149+
.Sh EXIT STATUS
150+
0 on normal exit, >0 for some errors. Errors are not always reflected
151+
in the exit status.
149152
.Sh FILES
150153
.Bl -tag -width /usr/share/misc/vgrindefsxx -compact
151154
.It Pa index
@@ -163,7 +166,7 @@ language descriptions (either the text or db version of vgrindefs is present.)
163166
.Xr groff 1 ,
164167
.Xr getcap 3 ,
165168
.Xr troff 1 ,
166-
.Xr vgrind 1 ,
169+
.Xr vgrind 1
167170
.Sh HISTORY
168171
The
169172
.Nm
@@ -213,6 +216,8 @@ works best if it is run from the directory of the files being
213216
formatted or a directory immediately above. Run from a remote
214217
directory, it produces long garbled headers.
215218
.Pp
219+
Due to the limitations of csh, error detection and processing is
220+
unreliable; an error does not always result in a non-zero return code.
216221
.Pp
217222
The mechanism of
218223
.Xr ctags 1

pprint.sh.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ while ($#argv > 0)
7575
echo "vgrind: $1:q option must have argument"
7676
exit 1
7777
else
78-
set options=( $options:q -h $2:q )
78+
set options=($options:q -h $2:q)
7979
shift
8080
shift
8181
breaksw
@@ -95,7 +95,11 @@ end
9595

9696
if ($f == 'filter') then
9797
$vf $options:q $files | cat $tm/$vmacs -
98+
set rc=$status
9899
else
99100
$vf $options:q $files |\
100101
groff -T pdf -C -i $voptions:q -M $tm -mvgrind
102+
set rc=$status
101103
endif
104+
105+
exit $rc

vgrind.1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ option and the file
190190
.Pa index
191191
as argument.
192192
.El
193+
.Sh EXIT STATUS
194+
0 on normal exit, >0 for some errors. Errors are not always reflected
195+
in the exit status.
193196
.Sh FILES
194197
.Bl -tag -width /usr/share/misc/vgrindefsxx -compact
195198
.It Pa index
@@ -260,6 +263,9 @@ HTML/CSS file by default (see the
260263
.Fl t
261264
option) might be better for modern usage.
262265
.Pp
266+
Due to the limitations of csh, error detection and processing is
267+
unreliable; an error does not always result in a non-zero return code.
268+
.Pp
263269
The mechanism of
264270
.Xr ctags 1
265271
in recognizing functions should be used here.

vgrind.sh.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ while ($#argv > 0)
9999
endsw
100100
end
101101

102+
set rc=0
102103
if (-r index) then
103104
echo > nindex
104105
foreach i ($files)
@@ -110,16 +111,20 @@ if (-r index) then
110111
if ($f == 'filter') then
111112
if ("$head" != "") then
112113
$vf $options -h "$head" $files | cat $tm/$vmacs -
114+
set rc=$status
113115
else
114116
$vf $options $files | cat $tm/$vmacs -
117+
set rc=$status
115118
endif
116119
else
117120
if ("$head" != "") then
118121
$vf $options -h "$head" $files | \
119122
sh -c "groff -Tps $lpoption -C -rx1 $voptions -i -M $tm -mvgrind 2>> xindex"
123+
set rc=$status
120124
else
121125
$vf $options $files | \
122126
sh -c "groff -Tps $lpoption -C -rx1 $voptions -i -M $tm -mvgrind 2>> xindex"
127+
set rc=$status
123128
endif
124129
endif
125130
sort -df +0 -2 xindex >index
@@ -128,14 +133,20 @@ else
128133
if ($f == 'filter') then
129134
if ("$head" != "") then
130135
$vf $options -h "$head" $files | cat $tm/$vmacs -
136+
set rc=$status
131137
else
132138
$vf $options $files | cat $tm/$vmacs -
139+
set rc=$status
133140
endif
134141
else
135142
if ("$head" != "") then
136143
$vf $options -h "$head" $files | groff -Tps $lpoption -C -i $voptions -M $tm -mvgrind
144+
set rc=$status
137145
else
138146
$vf $options $files | groff -Tps $lpoption -C -i $voptions -M $tm -mvgrind
147+
set rc=$status
139148
endif
140149
endif
141150
endif
151+
152+
exit $rc

0 commit comments

Comments
 (0)