| 1 |
< |
/* Copyright (c) 1991 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1992 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 34 |
|
|
| 35 |
|
int nfiles; /* number of input files */ |
| 36 |
|
|
| 37 |
+ |
char Command[] = "<Command>"; |
| 38 |
|
char vcolin[3][4] = {"ri", "gi", "bi"}; |
| 39 |
|
char vcolout[3][4] = {"ro", "go", "bo"}; |
| 40 |
|
char vbrtin[] = "li"; |
| 126 |
|
} |
| 127 |
|
else { |
| 128 |
|
if (argv[a][0] == '!') { |
| 129 |
< |
input[nfiles].name = "<Command>"; |
| 129 |
> |
input[nfiles].name = Command; |
| 130 |
|
input[nfiles].fp = popen(argv[a]+1, "r"); |
| 131 |
|
} else { |
| 132 |
|
input[nfiles].name = argv[a]; |
| 454 |
|
} |
| 455 |
|
|
| 456 |
|
|
| 456 |
– |
#ifdef NIX |
| 457 |
– |
|
| 458 |
– |
quit(code) |
| 459 |
– |
int code; |
| 460 |
– |
{ |
| 461 |
– |
exit(code); |
| 462 |
– |
} |
| 463 |
– |
|
| 464 |
– |
#else |
| 465 |
– |
|
| 466 |
– |
#include <signal.h> |
| 467 |
– |
|
| 457 |
|
quit(code) /* exit gracefully */ |
| 458 |
|
int code; |
| 459 |
|
{ |
| 460 |
< |
int status; |
| 461 |
< |
|
| 462 |
< |
if (code) { /* abnormal exit -- kill children */ |
| 463 |
< |
signal(SIGPIPE, SIG_IGN); |
| 464 |
< |
kill(0, SIGPIPE); |
| 465 |
< |
} |
| 466 |
< |
/* reap any children */ |
| 478 |
< |
while (wait(&status) != -1) |
| 479 |
< |
if (code == 0) |
| 480 |
< |
code = status>>8 & 0xff; |
| 460 |
> |
register int i; |
| 461 |
> |
/* close input files */ |
| 462 |
> |
for (i = 0; i < nfiles; i++) |
| 463 |
> |
if (input[i].name == Command) |
| 464 |
> |
pclose(input[i].fp); |
| 465 |
> |
else |
| 466 |
> |
fclose(input[i].fp); |
| 467 |
|
exit(code); |
| 468 |
|
} |
| 483 |
– |
|
| 484 |
– |
#endif |