--- ray/src/px/pcond.c 2004/03/28 20:33:14 3.21 +++ ray/src/px/pcond.c 2018/08/02 18:33:44 3.29 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: pcond.c,v 3.21 2004/03/28 20:33:14 schorsch Exp $"; +static const char RCSid[] = "$Id: pcond.c,v 3.29 2018/08/02 18:33:44 greg Exp $"; #endif /* * Condition Radiance picture for display/output @@ -8,7 +8,7 @@ static const char RCSid[] = "$Id: pcond.c,v 3.21 2004/ #include "platform.h" #include "paths.h" -#include "rtprocess.h" +#include "paths.h" #include "pcond.h" @@ -60,7 +60,7 @@ main( { static RGBPRIMS outprimS; int i; -#define bool(flg) switch (argv[i][2]) { \ +#define check_bool(flg) switch (argv[i][2]) { \ case '\0': what2do ^= flg; break; \ case 'y': case 'Y': case 't': case 'T': \ case '+': case '1': what2do |= flg; break; \ @@ -73,22 +73,22 @@ main( for (i = 1; i < argc && argv[i][0] == '-'; i++) switch (argv[i][1]) { case 'h': - bool(DO_HUMAN); + check_bool(DO_HUMAN); break; case 'a': - bool(DO_ACUITY); + check_bool(DO_ACUITY); break; case 'v': - bool(DO_VEIL); + check_bool(DO_VEIL); break; case 's': - bool(DO_HSENS); + check_bool(DO_HSENS); break; case 'c': - bool(DO_COLOR); + check_bool(DO_COLOR); break; case 'w': - bool(DO_CWEIGHT); + check_bool(DO_CWEIGHT); break; case 'i': if (i+1 >= argc) goto userr; @@ -97,10 +97,10 @@ main( else what2do &= ~DO_FIXHIST; break; case 'I': - bool(DO_PREHIST); + check_bool(DO_PREHIST); break; case 'l': - bool(DO_LINEAR); + check_bool(DO_LINEAR); break; case 'p': if (i+8 >= argc) goto userr; @@ -195,11 +195,11 @@ userr: progname); exit(1); return 1; /* pro forma return */ -#undef bool +#undef check_bool } -extern void +void syserror( /* report system error and exit */ char *s ) @@ -217,7 +217,7 @@ headline( /* process header line */ ) { static RGBPRIMS inprimS; - char fmt[32]; + char fmt[MAXFMTLEN]; if (formatval(fmt, s)) { /* check if format string */ if (!strcmp(fmt,COLRFMT)) lumf = rgblum; @@ -260,7 +260,8 @@ getahead(void) /* load picture header */ progname); exit(1); } - if (!gotview || ourview.type == VT_PAR) { + if (!gotview || ourview.type == VT_PAR || + (ourview.horiz <= 5.) | (ourview.vert <= 5.)) { ourview = stdview; ourview.type = VT_PER; if (pixaspect*inpres.yr < inpres.xr) { @@ -343,6 +344,7 @@ getfovimg(void) /* load foveal sampled image */ sprintf(combuf, "pfilt -1 -b -pa 0 -x %d -y %d \"%s\"", fvxr, fvyr, infn); if ((fp = popen(combuf, "r")) == NULL) syserror("popen"); + SET_FILE_BINARY(fp); getheader(fp, NULL, NULL); /* skip header */ if (fgetresolu(&x, &y, fp) < 0 || (x != fvxr) | (y != fvyr)) goto readerr; @@ -363,7 +365,7 @@ check2do(void) /* check histogram to see what isn't w { double sum; double b, l; - register int i; + int i; /* check for within display range */ if (bwmax - bwmin <= Bldmax - Bldmin)