| 1 |
– |
/* Copyright (c) 1992 Regents of the University of California */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* program to convert between RADIANCE and Poskanzer Pixmaps |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
|
#include <stdio.h> |
| 12 |
– |
|
| 13 |
– |
#ifdef MSDOS |
| 14 |
– |
#include <fcntl.h> |
| 15 |
– |
#endif |
| 16 |
– |
|
| 9 |
|
#include <math.h> |
| 18 |
– |
|
| 10 |
|
#include <ctype.h> |
| 11 |
+ |
#include <time.h> |
| 12 |
|
|
| 13 |
+ |
#include "platform.h" |
| 14 |
|
#include "color.h" |
| 22 |
– |
|
| 15 |
|
#include "resolu.h" |
| 16 |
|
|
| 17 |
|
|
| 26 |
– |
extern char *malloc(); |
| 27 |
– |
|
| 18 |
|
int agryscan(), bgryscan(), aclrscan(), bclrscan(); |
| 19 |
|
int agryscan2(), bgryscan2(), aclrscan2(), bclrscan2(); |
| 20 |
|
int normval(); |
| 94 |
|
if (read(fileno(stdin), inpbuf, 2) != 2 || inpbuf[0] != 'P') |
| 95 |
|
quiterr("input not a Poskanzer Pixmap"); |
| 96 |
|
ptype = inpbuf[1]; |
| 97 |
< |
#ifdef MSDOS |
| 97 |
> |
#ifdef _WIN32 |
| 98 |
|
if (ptype > 4) |
| 99 |
< |
setmode(fileno(stdin), O_BINARY); |
| 100 |
< |
setmode(fileno(stdout), O_BINARY); |
| 99 |
> |
SET_FILE_BINARY(stdin); |
| 100 |
> |
SET_FILE_BINARY(stdout); |
| 101 |
|
#endif |
| 102 |
|
xmax = scanint(stdin); |
| 103 |
|
ymax = scanint(stdin); |
| 144 |
|
quiterr("unsupported Pixmap type"); |
| 145 |
|
} |
| 146 |
|
} else { |
| 147 |
< |
#ifdef MSDOS |
| 148 |
< |
setmode(fileno(stdin), O_BINARY); |
| 147 |
> |
#ifdef _WIN32 |
| 148 |
> |
SET_FILE_BINARY(stdin); |
| 149 |
|
if (binflag) |
| 150 |
< |
setmode(fileno(stdout), O_BINARY); |
| 150 |
> |
SET_FILE_BINARY(stdout); |
| 151 |
|
#endif |
| 152 |
|
/* get header info. */ |
| 153 |
|
if (checkheader(stdin, COLRFMT, NULL) < 0 || |
| 202 |
|
quiterr("error writing Radiance picture"); |
| 203 |
|
} |
| 204 |
|
/* free scanline */ |
| 205 |
< |
free((char *)scanout); |
| 205 |
> |
free((void *)scanout); |
| 206 |
|
} |
| 207 |
|
|
| 208 |
|
|
| 248 |
|
quiterr("error writing Pixmap"); |
| 249 |
|
} |
| 250 |
|
/* free scanline */ |
| 251 |
< |
free((char *)scanin); |
| 251 |
> |
free((void *)scanin); |
| 252 |
|
} |
| 253 |
|
|
| 254 |
|
|
| 283 |
|
quiterr("error writing Radiance picture"); |
| 284 |
|
} |
| 285 |
|
/* free scanline */ |
| 286 |
< |
free((char *)scanout); |
| 286 |
> |
free((void *)scanout); |
| 287 |
|
} |
| 288 |
|
|
| 289 |
|
|
| 347 |
|
quiterr("error writing Pixmap"); |
| 348 |
|
} |
| 349 |
|
/* free scanline */ |
| 350 |
< |
free((char *)scanin); |
| 350 |
> |
free((void *)scanin); |
| 351 |
|
} |
| 352 |
|
|
| 353 |
|
|