--- ray/src/px/pfilt.c 1996/04/01 17:24:44 2.17 +++ ray/src/px/pfilt.c 1998/10/27 09:08:26 2.20 @@ -70,6 +70,8 @@ VIEW ourview = STDVIEW; int gotview = 0; int wrapfilt = 0; /* wrap filter horizontally? */ +int estatus = 0; /* exit status (for non-fatal errors) */ + int xrad; /* x search radius */ int yrad; /* y search radius */ int xbrad; /* x box size */ @@ -153,7 +155,7 @@ char **argv; fprintf(stderr, "%s: exposure out of range\n", argv[0]); - exit(1); + quit(1); } switch (argv[i][2]) { case '\0': @@ -307,7 +309,7 @@ char **argv; } pass2(fin); - quit(0); + quit(estatus); } @@ -330,6 +332,7 @@ COLOR clr; double (*ourbright)() = rgb_bright; +int headline(s) /* process line from header */ char *s; { @@ -350,6 +353,7 @@ char *s; wrongformat = !globmatch(PICFMT, fmt); } else if (isview(s) && sscanview(&ourview, s) > 0) gotview++; + return(0); } @@ -392,6 +396,7 @@ FILE *in; progname, (int)(100L*i/yres)); yres = i; y_r = (double)nrows/yres; + estatus++; break; } pass1scan(scan, i); @@ -411,7 +416,7 @@ FILE *in; scan2init(); yread = 0; for (r = 0; r < nrows; r++) { - ycent = (long)r*yres/nrows; + ycent = (r+.5)*yres/nrows; while (yread <= ycent+yrad) { if (yread < yres) { if (freadscan(scanin[yread%barsize], @@ -428,7 +433,7 @@ FILE *in; if (obarsize > 0) scan2sync(r); for (c = 0; c < ncols; c++) { - xcent = (long)c*xres/ncols; + xcent = (c+.5)*xres/ncols; if (thresh > FTINY) dothresh(xcent, ycent, c, r); else if (rad > FTINY) @@ -537,9 +542,9 @@ int r; register int c; /* average input scanlines */ while (nextrow <= r+orad && nextrow < nrows) { - ybot = (long)nextrow*yres/nrows; + ybot = (nextrow+.5)*yres/nrows; for (c = 0; c < ncols; c++) { - dobox(ctmp, (int)((long)c*xres/ncols),ybot, c,nextrow); + dobox(ctmp, (int)((c+.5)*xres/ncols),ybot, c,nextrow); greybar[nextrow%obarsize][c] = (*ourbright)(ctmp); } /* and zero output scanline */ @@ -563,7 +568,7 @@ scan2flush() /* flush output buffer */ break; if (fflush(stdout) < 0) { fprintf(stderr, "%s: write error at end of pass2\n", progname); - exit(1); + quit(1); } }