--- ray/src/px/pextrem.c 1993/10/19 17:23:31 2.3 +++ ray/src/px/pextrem.c 2005/06/02 18:13:47 2.11 @@ -1,19 +1,17 @@ -/* Copyright (c) 1992 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: pextrem.c,v 2.11 2005/06/02 18:13:47 greg Exp $"; #endif - /* * Find extrema points in a Radiance picture. */ #include #include -#ifdef MSDOS -#include -#endif +#include + +#include "platform.h" #include "color.h" +#include "resolu.h" int orig = 0; @@ -22,11 +20,14 @@ int wrongformat = 0; COLOR expos = WHTCOLOR; -extern char *malloc(); +static gethfunc headline; -headline(s) /* check header line */ -char *s; +static int +headline( /* check header line */ + char *s, + void *p +) { char fmt[32]; double d; @@ -34,10 +35,10 @@ char *s; if (isformat(s)) { /* format */ formatval(fmt, s); - wrongformat = strcmp(fmt, COLRFMT); + wrongformat = !globmatch(PICFMT, fmt); } if (!orig) - return; + return(0); if (isexpos(s)) { /* exposure */ d = exposval(s); scalecolor(expos, d); @@ -45,12 +46,15 @@ char *s; colcorval(ctmp, s); multcolor(expos, ctmp); } + return(0); } -main(argc, argv) -int argc; -char *argv[]; +int +main( + int argc, + char *argv[] +) { int i; int xres, yres; @@ -59,11 +63,8 @@ char *argv[]; COLR *scan; COLR cmin, cmax; int xmin, ymin, xmax, ymax; -#ifdef MSDOS - extern int _fmode; - _fmode = O_BINARY; - setmode(fileno(stdin), O_BINARY); -#endif + SET_DEFAULT_BINARY(); + SET_FILE_BINARY(stdin); for (i = 1; i < argc; i++) /* get options */ if (!strcmp(argv[i], "-o")) orig++; @@ -85,8 +86,8 @@ char *argv[]; fprintf(stderr, "%s: out of memory\n", argv[0]); exit(1); } - setcolr(cmin, 1e10, 1e10, 1e10); - setcolr(cmax, 0., 0., 0.); + setcolr(cmin, 1e30, 1e30, 1e30); + setcolr(cmax, 0., 0., 0.); xmax=ymax=0; /* find extrema */ for (y = yres-1; y >= 0; y--) { if (freadcolrs(scan, xres, stdin) < 0) { @@ -110,7 +111,7 @@ char *argv[]; } } } - free((char *)scan); + free((void *)scan); printf("%d %d\t%e %e %e\n", xmin, ymin, colrval(cmin,RED)/colval(expos,RED), colrval(cmin,GRN)/colval(expos,GRN),