375 |
|
|
376 |
|
#else |
377 |
|
|
378 |
– |
#include <signal.h> |
379 |
– |
|
378 |
|
quit(code) /* exit gracefully */ |
379 |
|
int code; |
380 |
|
{ |
381 |
< |
int status; |
382 |
< |
|
383 |
< |
if (code) { /* abnormal exit -- kill children */ |
384 |
< |
signal(SIGPIPE, SIG_IGN); |
387 |
< |
kill(0, SIGPIPE); |
388 |
< |
} |
381 |
> |
register int i; |
382 |
> |
/* close input files */ |
383 |
> |
for (i = 0; i < nfile; i++) |
384 |
> |
fclose(input[i].fp); |
385 |
|
/* reap any children */ |
386 |
< |
while (wait(&status) != -1) |
387 |
< |
if (code == 0) |
392 |
< |
code = status>>8 & 0xff; |
386 |
> |
while (wait(0) != -1) |
387 |
> |
; |
388 |
|
exit(code); |
389 |
|
} |
390 |
|
|