--- ray/src/px/ra_pict.c 1991/12/19 14:52:09 2.4 +++ ray/src/px/ra_pict.c 2003/06/05 19:29:34 2.9 @@ -1,10 +1,7 @@ #ifndef lint -static char SCCSid[] = "$SunId$ Auckuni"; +static const char RCSid[] = "$Id: ra_pict.c,v 2.9 2003/06/05 19:29:34 schorsch Exp $"; #endif - -/* - * rad2pict - - * Convert an Radiance image to APPLE pict format. +/* Convert an Radiance image to APPLE pict format. * * Orginally Iris to PICT by Paul Haeberli - 1990 * Hacked into Rad to PICT by Russell Street 1990 @@ -20,17 +17,18 @@ static char SCCSid[] = "$SunId$ Auckuni"; */ #include +#include +#include +#include "platform.h" #include "pict.h" #include "color.h" #include "resolu.h" -extern char *malloc(); - int outbytes; /* This had better be 32 bits! */ char *progname; int verbose = 0; -float gamma = 2.0; +float gamcor = 2.0; int bradj = 0; /* First some utility routines */ @@ -97,13 +95,15 @@ char **argv; int xsize, ysize; int i, picsize; int ssizepos, lsizepos; - + SET_DEFAULT_BINARY(); + SET_FILE_BINARY(stdin); + SET_FILE_BINARY(stdout); progname = argv[0]; for (i = 1; i < argc ; i++) - if (argv[i][0] == '-') + if (argv[i][0] == '-') switch (argv[i][1]) { - case 'g': gamma = atof(argv[++i]); + case 'g': gamcor = atof(argv[++i]); break; case 'e': if (argv[i+1][0] != '+' && argv[i+1][0] != '-') @@ -148,46 +148,46 @@ outofparse: #ifdef DEBUG fprintf(stderr, "Input file: %s\n", i <= argc - 1 ? argv[i] : "stdin"); - fprintf(stderr, "Outut file: %s\n", i <= argc - 2 ? argv[i+1] : "stdout" ); - fprintf(stderr, "Gamma: %f\n", gamma); + fprintf(stderr, "Outut file: %s\n", i <= argc - 2 ? argv[i+1] : "stdout" ); + fprintf(stderr, "Gamma: %f\n", gamcor); fprintf(stderr, "Brightness adjust: %d\n", bradj); - fprintf(stderr, "Verbose: %s\n", verbose ? "on" : "off"); + fprintf(stderr, "Verbose: %s\n", verbose ? "on" : "off"); #endif - /* OK. Now we read the size of the Radiance picture */ + /* OK. Now we read the size of the Radiance picture */ if (checkheader(stdin, COLRFMT, NULL) < 0 || - fgetresolu(&xsize, &ysize, stdin) < 0 /* != (YMAJOR|YDECR) */ ) { - fprintf(stderr, "%s: not a radiance picture\n", progname); - exit(1); + fgetresolu(&xsize, &ysize, stdin) < 0 /* != (YMAJOR|YDECR) */ ) { + fprintf(stderr, "%s: not a radiance picture\n", progname); + exit(1); } /* Set the gamma correction */ - setcolrgam(gamma); + setcolrgam(gamcor); for(i=0; i