--- ray/src/px/pcomb.c 1992/08/13 10:49:08 2.4 +++ ray/src/px/pcomb.c 1992/10/02 16:22:51 2.8 @@ -1,4 +1,4 @@ -/* Copyright (c) 1991 Regents of the University of California */ +/* Copyright (c) 1992 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -12,11 +12,17 @@ static char SCCSid[] = "$SunId$ LBL"; #include +#ifdef MSDOS +#include +#endif + +#include + #include #include "color.h" -#include "resolu.h" +#include "resolu.h" #include "calcomp.h" @@ -34,6 +40,7 @@ struct { int nfiles; /* number of input files */ +char Command[] = ""; char vcolin[3][4] = {"ri", "gi", "bi"}; char vcolout[3][4] = {"ro", "go", "bo"}; char vbrtin[] = "li"; @@ -63,7 +70,9 @@ int wrongformat = 0; FILE *popen(); +extern char *emalloc(); + main(argc, argv) int argc; char *argv[]; @@ -71,6 +80,12 @@ char *argv[]; int original; double f; int a, i; +#ifdef MSDOS + extern int _fmode; + _fmode = O_BINARY; + setmode(fileno(stdin), O_BINARY); + setmode(fileno(stdout), O_BINARY); +#endif /* scan options */ for (a = 1; a < argc; a++) { if (argv[a][0] == '-') @@ -125,7 +140,7 @@ char *argv[]; } else { if (argv[a][0] == '!') { - input[nfiles].name = ""; + input[nfiles].name = Command; input[nfiles].fp = popen(argv[a]+1, "r"); } else { input[nfiles].name = argv[a]; @@ -334,7 +349,6 @@ combine() /* combine pictures */ advance() /* read in data for next scanline */ { - extern double fabs(); int ytarget; register COLOR *st; register int i, j; @@ -453,32 +467,15 @@ char *msg; } -#ifdef NIX - -quit(code) -int code; -{ - exit(code); -} - -#else - -#include - quit(code) /* exit gracefully */ int code; { - int status; - - if (code) { /* abnormal exit -- kill children */ - signal(SIGPIPE, SIG_IGN); - kill(0, SIGPIPE); - } - /* reap any children */ - while (wait(&status) != -1) - if (code == 0) - code = status>>8 & 0xff; + register int i; + /* close input files */ + for (i = 0; i < nfiles; i++) + if (input[i].name == Command) + pclose(input[i].fp); + else + fclose(input[i].fp); exit(code); } - -#endif