--- ray/src/px/ra_pict.c 1991/11/21 11:34:10 2.2 +++ ray/src/px/ra_pict.c 1993/07/19 12:04:35 2.7 @@ -1,10 +1,10 @@ +/* Copyright (c) 1992 Regents of the University of California */ + #ifndef lint -static char SCCSid[] = "$SunId$ Auckuni"; +static char SCCSid[] = "$SunId$ LBL"; #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,16 +20,21 @@ static char SCCSid[] = "$SunId$ Auckuni"; */ #include -#include +#include +#ifdef MSDOS +#include +#endif #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 */ @@ -96,13 +101,18 @@ char **argv; int xsize, ysize; int i, picsize; int ssizepos, lsizepos; - +#ifdef MSDOS + extern int _fmode; + _fmode = O_BINARY; + setmode(fileno(stdin), O_BINARY); + setmode(fileno(stdout), O_BINARY); +#endif 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] != '-') @@ -147,46 +157,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