61 |
|
|
62 |
|
int warnings = 1; /* print warnings? */ |
63 |
|
|
64 |
+ |
int done_rprocs(struct rtproc *rtp); |
65 |
|
void init(int np); |
66 |
|
void filter(register FILE *infp, char *name); |
67 |
|
void xoptions(char *s, char *nm); |
171 |
|
fclose(fp); |
172 |
|
} |
173 |
|
|
174 |
+ |
int |
175 |
+ |
done_rprocs(struct rtproc *rtp) |
176 |
+ |
{ |
177 |
+ |
int st0, st1 = 0; |
178 |
+ |
|
179 |
+ |
if (rtp->next != NULL) { /* close last opened first! */ |
180 |
+ |
st1 = done_rprocs(rtp->next); |
181 |
+ |
free((void *)rtp->next); |
182 |
+ |
rtp->next = NULL; |
183 |
+ |
} |
184 |
+ |
st0 = close_process(&rtp->pd); |
185 |
+ |
if (st0 < 0) |
186 |
+ |
error(WARNING, "unknown return status from rtrace process"); |
187 |
+ |
else if (st0 > 0) |
188 |
+ |
return(st0); |
189 |
+ |
return(st1); |
190 |
+ |
} |
191 |
+ |
|
192 |
|
void |
193 |
|
quit(int status) /* exit with status */ |
194 |
|
{ |
176 |
– |
struct rtproc *rtp; |
195 |
|
int rtstat; |
196 |
|
|
197 |
|
if (rt0.next != NULL) /* terminate persistent rtrace */ |
198 |
|
killpersist(); |
199 |
|
/* clean up rtrace process(es) */ |
200 |
< |
for (rtp = &rt0; rtp != NULL; rtp = rtp->next) { |
201 |
< |
rtstat = close_process(&rtp->pd); |
202 |
< |
if (status == 0) { |
185 |
< |
if (rtstat < 0) |
186 |
< |
error(WARNING, |
187 |
< |
"unknown return status from rtrace process"); |
188 |
< |
else |
189 |
< |
status = rtstat; |
190 |
< |
} |
191 |
< |
} |
200 |
> |
rtstat = done_rprocs(&rt0); |
201 |
> |
if (status == 0) |
202 |
> |
status = rtstat; |
203 |
|
exit(status); |
204 |
|
} |
205 |
|
|