--- ray/src/px/pfilt.c 1998/10/27 09:08:26 2.20 +++ ray/src/px/pfilt.c 2003/10/22 02:06:35 2.27 @@ -1,9 +1,6 @@ -/* Copyright (c) 1996 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: pfilt.c,v 2.27 2003/10/22 02:06:35 greg Exp $"; #endif - /* * pfilt.c - program to post-process picture file. * @@ -11,23 +8,22 @@ static char SCCSid[] = "$SunId$ LBL"; * 6/23/93 Added additional buffers for value spreading */ -#include "standard.h" +#include "copyright.h" #include +#include +#include "platform.h" +#include "standard.h" #include "color.h" - #include "view.h" - -#include "resolu.h" - #include "paths.h" extern float *matchlamp(); #define FEQ(a,b) ((a) >= .98*(b) && (a) <= 1.02*(b)) -double CHECKRAD = 1.5; /* radius to check for filtering */ +double CHECKRAD = 2.0; /* radius to check for filtering */ #define THRESHRAD 5.0 /* maximum sample spread in output */ @@ -92,8 +88,7 @@ main(argc, argv) int argc; char **argv; { - extern long ftell(); - extern int quit(), headline(); + extern int headline(); FILE *fin; float *lampcolor; char *lamptype = NULL; @@ -101,18 +96,19 @@ char **argv; double outaspect = 0.0; double d; int i, j; -#ifdef MSDOS - extern int _fmode; - _fmode = O_BINARY; - setmode(fileno(stdin), O_BINARY); - setmode(fileno(stdout), O_BINARY); -#endif + SET_DEFAULT_BINARY(); + SET_FILE_BINARY(stdin); + SET_FILE_BINARY(stdout); if (signal(SIGINT, quit) == SIG_IGN) signal(SIGINT, SIG_IGN); +#ifdef SIGHUP if (signal(SIGHUP, quit) == SIG_IGN) signal(SIGHUP, SIG_IGN); +#endif signal(SIGTERM, quit); +#ifdef SIGPIPE signal(SIGPIPE, quit); +#endif #ifdef SIGXCPU signal(SIGXCPU, quit); signal(SIGXFSZ, quit); @@ -205,7 +201,7 @@ char **argv; case 'm': thresh = atof(argv[++i]); if (rad <= FTINY) - rad = 1.0; + rad = 0.6; break; case 'b': rad = thresh = 0.0; @@ -401,7 +397,7 @@ FILE *in; } pass1scan(scan, i); } - free((char *)scan); + free((void *)scan); } @@ -494,12 +490,12 @@ scan2init() /* prepare scanline arrays */ if (obarsize > 0) { scoutbar = (COLOR **)malloc(obarsize*sizeof(COLOR *)); greybar = (float **)malloc(obarsize*sizeof(float *)); - if (scoutbar == NULL | greybar == NULL) + if ((scoutbar == NULL) | (greybar == NULL)) goto memerr; for (i = 0; i < obarsize; i++) { scoutbar[i] = (COLOR *)malloc(ncols*sizeof(COLOR)); greybar[i] = (float *)malloc(ncols*sizeof(float)); - if (scoutbar[i] == NULL | greybar[i] == NULL) + if ((scoutbar[i] == NULL) | (greybar[i] == NULL)) goto memerr; } } else { @@ -548,7 +544,7 @@ int r; greybar[nextrow%obarsize][c] = (*ourbright)(ctmp); } /* and zero output scanline */ - bzero((char *)scoutbar[nextrow%obarsize], ncols*sizeof(COLOR)); + memset((char *)scoutbar[nextrow%obarsize], '\0', ncols*sizeof(COLOR)); nextrow++; } /* point to top scanline for output */ @@ -573,6 +569,7 @@ scan2flush() /* flush output buffer */ } +void quit(code) /* remove temporary file and exit */ int code; {