19 |
|
|
20 |
|
#define MAXFILE 512 /* maximum number of files */ |
21 |
|
|
22 |
+ |
static int swapped = 0; /* input is byte-swapped */ |
23 |
+ |
|
24 |
|
static FILE *output[MAXFILE]; |
25 |
|
static int bytsiz[MAXFILE]; |
26 |
|
static short hdrflags[MAXFILE]; |
38 |
|
headline(char *s, void *p) |
39 |
|
{ |
40 |
|
extern const char FMTSTR[]; |
41 |
< |
int i = nfiles; |
41 |
> |
int i; |
42 |
|
|
43 |
|
if (strstr(s, FMTSTR) == s) |
44 |
|
return(0); /* don't copy format */ |
48 |
|
return(0); |
49 |
|
if (!strncmp(s, "NCOMP=", 6)) |
50 |
|
return(0); |
51 |
+ |
if ((i = isbigendian(s)) >= 0) { |
52 |
+ |
swapped = (nativebigendian() != i); |
53 |
+ |
return(0); |
54 |
+ |
} |
55 |
+ |
i = nfiles; |
56 |
|
while (i--) /* else copy line to output streams */ |
57 |
|
if (hdrflags[i] & DOHEADER) |
58 |
|
fputs(s, output[i]); |
281 |
|
if (!(inpflags & DOHEADER)) |
282 |
|
newheader("RADIANCE", output[i]); |
283 |
|
printargs(argc, argv, output[i]); |
284 |
< |
if (format[i] != NULL) |
284 |
> |
if (format[i] != NULL) { |
285 |
> |
extern const char BIGEND[]; |
286 |
> |
if ((format[i][0] == 'f') | |
287 |
> |
(format[i][0] == 'd')) { |
288 |
> |
fputs(BIGEND, output[i]); |
289 |
> |
fputs(nativebigendian() ^ swapped ? |
290 |
> |
"1\n" : "0\n", output[i]); |
291 |
> |
} |
292 |
|
fputformat(format[i], output[i]); |
293 |
+ |
} |
294 |
|
fputc('\n', output[i]); |
295 |
|
} |
296 |
|
if (hdrflags[i] & DORESOLU) |