--- ray/src/px/ra_skel.c 1993/07/12 12:41:16 2.6 +++ ray/src/px/ra_skel.c 2003/02/22 02:07:28 2.11 @@ -1,14 +1,11 @@ -/* Copyright (c) 1992 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: ra_skel.c,v 2.11 2003/02/22 02:07:28 greg Exp $"; #endif - /* * Skeletal 24-bit image conversion program. Replace "skel" * in this file with a more appropriate image type identifier. * - * The Makefile entry should look something like this: + * The Rmakefile entry should look something like this: * ra_skel: ra_skel.o * cc $(CFLAGS) -o ra_skel ra_skel.o -lrt -lm * ra_skel.o: ../common/color.h ../common/resolu.h @@ -23,11 +20,10 @@ static char SCCSid[] = "$SunId$ LBL"; #ifdef MSDOS #include #endif +#include #include "color.h" #include "resolu.h" -extern char *malloc(); - double gamcor = 2.2; /* gamma correction */ int bradj = 0; /* brightness adjustment */ @@ -74,7 +70,7 @@ char *argv[]; exit(1); } if (i == argc-2 && freopen(argv[i+1], "w", stdout) == NULL) { - fprintf(stderr, "can't open output \"%s\"\n", + fprintf(stderr, "%s: can't open output \"%s\"\n", progname, argv[i+1]); exit(1); } @@ -87,6 +83,7 @@ char *argv[]; /* get their image resolution */ read_skel_head(&xmax, &ymax); /* put our header */ + newheader("RADIANCE", stdout); printargs(i, argv, stdout); fputformat(COLRFMT, stdout); putchar('\n'); @@ -134,10 +131,12 @@ skel2ra() /* convert 24-bit scanlines to Radiance pic quiterr("out of memory in skel2ra"); /* convert image */ for (y = ymax-1; y >= 0; y--) { - scanout[x][RED] = getc(stdin); - scanout[x][GRN] = getc(stdin); - scanout[x][BLU] = getc(stdin); - if (feof(stdin) || ferror(stdin)) + for (x = 0; x < xmax; x++) { + scanout[x][RED] = getc(stdin); + scanout[x][GRN] = getc(stdin); + scanout[x][BLU] = getc(stdin); + } + if (feof(stdin) | ferror(stdin)) quiterr("error reading skel image"); /* undo gamma */ gambs_colrs(scanout, xmax); @@ -147,7 +146,7 @@ skel2ra() /* convert 24-bit scanlines to Radiance pic quiterr("error writing Radiance picture"); } /* free scanline */ - free((char *)scanout); + free((void *)scanout); } @@ -176,5 +175,5 @@ ra2skel() /* convert Radiance scanlines to 24-bit */ quiterr("error writing skel file"); } /* free scanline */ - free((char *)scanin); + free((void *)scanin); }