--- ray/src/px/pcomb.c 1991/08/14 15:00:34 1.21 +++ ray/src/px/pcomb.c 1992/08/10 12:10:26 2.3 @@ -16,6 +16,8 @@ static char SCCSid[] = "$SunId$ LBL"; #include "color.h" +#include "resolu.h" + #include "calcomp.h" #define MAXINP 32 /* maximum number of input files */ @@ -108,7 +110,7 @@ char *argv[]; break; case 'o': original++; - break; + continue; case 's': f = atof(argv[++a]); scalecolor(input[nfiles].coef, f); @@ -122,10 +124,13 @@ char *argv[]; goto usage; } else { - input[nfiles].name = argv[a]; - input[nfiles].fp = argv[a][0]=='!' ? - popen(argv[a]+1, "r") : - fopen(argv[a], "r"); + if (argv[a][0] == '!') { + input[nfiles].name = ""; + input[nfiles].fp = popen(argv[a]+1, "r"); + } else { + input[nfiles].name = argv[a]; + input[nfiles].fp = fopen(argv[a], "r"); + } if (input[nfiles].fp == NULL) { perror(argv[a]); quit(1); @@ -181,7 +186,7 @@ char *argv[]; printargs(argc, argv, stdout); fputformat(COLRFMT, stdout); putchar('\n'); - fputresolu(YMAJOR|YDECR, xres, yres, stdout); + fprtresolu(xres, yres, stdout); /* combine pictures */ combine(); quit(0); @@ -232,7 +237,7 @@ checkfile() /* ready a file */ eputs(": not in Radiance picture format\n"); quit(1); } - if (fgetresolu(&xinp, &yinp, input[nfiles].fp) != (YMAJOR|YDECR)) { + if (fgetresolu(&xinp, &yinp, input[nfiles].fp) < 0) { eputs(input[nfiles].name); eputs(": bad picture size\n"); quit(1); @@ -447,5 +452,11 @@ char *msg; quit(code) int code; { + int status; + + if (code == 0) /* reap any children */ + while (wait(&status) != -1) + if (code == 0) + code = status>>8 & 0xff; exit(code); }