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 from RADIANCE RLE to flat format |
6 |
|
*/ |
7 |
|
|
8 |
|
#include <stdio.h> |
9 |
|
#include <math.h> |
10 |
+ |
#include <time.h> |
11 |
+ |
#include <string.h> |
12 |
+ |
|
13 |
+ |
#include "platform.h" |
14 |
+ |
#include "rtprocess.h" |
15 |
|
#include "color.h" |
16 |
|
#include "resolu.h" |
17 |
|
|
16 |
– |
#ifdef MSDOS |
17 |
– |
#include <fcntl.h> |
18 |
– |
#endif |
19 |
– |
|
20 |
– |
extern char *malloc(), *realloc(), *tempbuffer(); |
21 |
– |
extern int addhline(); |
22 |
– |
|
18 |
|
#define dumpheader(fp) fwrite(headlines, 1, headlen, fp) |
19 |
|
|
20 |
|
int bradj = 0; /* brightness adjustment */ |
32 |
|
|
33 |
|
char *progname; |
34 |
|
|
35 |
+ |
static gethfunc addhline; |
36 |
|
|
37 |
+ |
|
38 |
|
main(argc, argv) |
39 |
|
int argc; |
40 |
|
char *argv[]; |
77 |
|
progname, argv[i]); |
78 |
|
exit(1); |
79 |
|
} |
80 |
< |
#ifdef MSDOS |
84 |
< |
setmode(fileno(stdin), O_BINARY); |
85 |
< |
#endif |
80 |
> |
SET_FILE_BINARY(stdin); |
81 |
|
ospec = i==argc-2 ? argv[i+1] : (char *)NULL; |
82 |
|
while (transfer(ospec)) |
83 |
|
; |
93 |
|
transfer(ospec) /* transfer a Radiance picture */ |
94 |
|
char *ospec; |
95 |
|
{ |
96 |
< |
char oname[128]; |
96 |
> |
char oname[PATH_MAX]; |
97 |
|
FILE *fp; |
98 |
|
int order; |
99 |
|
int xmax, ymax; |
152 |
|
} |
153 |
|
} |
154 |
|
} |
155 |
< |
#ifdef MSDOS |
161 |
< |
setmode(fileno(fp), O_BINARY); |
162 |
< |
#endif |
155 |
> |
SET_FILE_BINARY(fp); |
156 |
|
dumpheader(fp); /* put out header */ |
157 |
|
fputs(progname, fp); |
158 |
|
if (bradj) |
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
< |
int |
196 |
< |
addhline(s) /* add a line to our info. header */ |
197 |
< |
char *s; |
195 |
> |
static int |
196 |
> |
addhline( /* add a line to our info. header */ |
197 |
> |
char *s, |
198 |
> |
void *p |
199 |
> |
) |
200 |
|
{ |
201 |
|
char fmt[32]; |
202 |
|
int n; |
207 |
|
frameno = atoi(s+6); |
208 |
|
n = strlen(s); |
209 |
|
if (headlen) |
210 |
< |
headlines = (char *)realloc(headlines, headlen+n+1); |
210 |
> |
headlines = (char *)realloc((void *)headlines, headlen+n+1); |
211 |
|
else |
212 |
|
headlines = (char *)malloc(n+1); |
213 |
|
if (headlines == NULL) { |