--- ray/src/px/pcond.c 2003/10/27 10:24:51 3.18 +++ ray/src/px/pcond.c 2004/03/28 20:33:14 3.21 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: pcond.c,v 3.18 2003/10/27 10:24:51 schorsch Exp $"; +static const char RCSid[] = "$Id: pcond.c,v 3.21 2004/03/28 20:33:14 schorsch Exp $"; #endif /* * Condition Radiance picture for display/output @@ -7,6 +7,7 @@ static const char RCSid[] = "$Id: pcond.c,v 3.18 2003/ */ #include "platform.h" +#include "paths.h" #include "rtprocess.h" #include "pcond.h" @@ -43,10 +44,19 @@ double bwavg; /* mean brightness */ double scalef = 0.; /* linear scaling factor */ +static gethfunc headline; +static void getahead(void); +static void mapimage(void); +static void getfovimg(void); +static void check2do(void); -main(argc, argv) -int argc; -char *argv[]; + + +int +main( + int argc, + char *argv[] +) { static RGBPRIMS outprimS; int i; @@ -184,12 +194,15 @@ userr: fprintf(stderr, "Usage: %s [-{h|a|v|s|c|l|w}[+-]][-I|-i ffrac][-e ev][-p xr yr xg yg xb yb xw yw|-f mbf.cal|-m rgb.cwp][-u Ldmax][-d Lddyn][-x mapfile] inpic [outpic]\n", progname); exit(1); + return 1; /* pro forma return */ #undef bool } -syserror(s) /* report system error and exit */ -char *s; +extern void +syserror( /* report system error and exit */ + char *s +) { fprintf(stderr, "%s: ", progname); perror(s); @@ -197,8 +210,11 @@ char *s; } -headline(s) /* process header line */ -char *s; +static int +headline( /* process header line */ + char *s, + void *p +) { static RGBPRIMS inprimS; char fmt[32]; @@ -226,7 +242,8 @@ char *s; } -getahead() /* load picture header */ +static void +getahead(void) /* load picture header */ { char *err; @@ -264,7 +281,8 @@ getahead() /* load picture header */ } -mapimage() /* map picture and send to stdout */ +static void +mapimage(void) /* map picture and send to stdout */ { COLOR *scan; @@ -304,9 +322,10 @@ mapimage() /* map picture and send to stdout */ } -getfovimg() /* load foveal sampled image */ +static void +getfovimg(void) /* load foveal sampled image */ { - char combuf[128]; + char combuf[PATH_MAX]; FILE *fp; int x, y; /* compute image size */ @@ -321,7 +340,7 @@ getfovimg() /* load foveal sampled image */ } if ((fovimg = (COLOR *)malloc(fvxr*fvyr*sizeof(COLOR))) == NULL) syserror("malloc"); - sprintf(combuf, "pfilt -1 -b -pa 0 -x %d -y %d %s", fvxr, fvyr, infn); + sprintf(combuf, "pfilt -1 -b -pa 0 -x %d -y %d \"%s\"", fvxr, fvyr, infn); if ((fp = popen(combuf, "r")) == NULL) syserror("popen"); getheader(fp, NULL, NULL); /* skip header */ @@ -339,7 +358,8 @@ readerr: } -check2do() /* check histogram to see what isn't worth doing */ +static void +check2do(void) /* check histogram to see what isn't worth doing */ { double sum; double b, l;