1 |
– |
/* Copyright (c) 1991 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 |
|
* lookamb.c - program to examine ambient components. |
9 |
– |
* |
10 |
– |
* 10/8/86 |
6 |
|
*/ |
7 |
|
|
8 |
< |
#include <stdio.h> |
8 |
> |
#include "copyright.h" |
9 |
|
|
10 |
< |
#ifdef MSDOS |
11 |
< |
#include <fcntl.h> |
17 |
< |
#endif |
18 |
< |
|
19 |
< |
#include "color.h" |
20 |
< |
|
10 |
> |
#include "platform.h" |
11 |
> |
#include "ray.h" |
12 |
|
#include "ambient.h" |
13 |
+ |
#include "resolu.h" |
14 |
|
|
15 |
|
|
16 |
|
int dataonly = 0; |
20 |
|
AMBVAL av; |
21 |
|
|
22 |
|
|
23 |
< |
main(argc, argv) /* load ambient values from a file */ |
24 |
< |
char *argv[]; |
23 |
> |
int |
24 |
> |
main( /* load ambient values from a file */ |
25 |
> |
int argc, |
26 |
> |
char *argv[] |
27 |
> |
) |
28 |
|
{ |
29 |
|
FILE *fp; |
30 |
|
int i; |
59 |
|
if (header) { |
60 |
|
if (checkheader(fp, "ascii", stdout) < 0) |
61 |
|
goto formaterr; |
62 |
< |
} else |
62 |
> |
} else { |
63 |
> |
newheader("RADIANCE", stdout); |
64 |
|
printargs(argc, argv, stdout); |
65 |
+ |
} |
66 |
|
fputformat(AMBFMT, stdout); |
67 |
|
putchar('\n'); |
68 |
< |
#ifdef MSDOS |
72 |
< |
setmode(fileno(stdout), O_BINARY); |
73 |
< |
#endif |
68 |
> |
SET_FILE_BINARY(stdout); |
69 |
|
putambmagic(stdout); |
70 |
|
writamb(fp); |
71 |
|
} else { |
72 |
< |
#ifdef MSDOS |
78 |
< |
setmode(fileno(fp), O_BINARY); |
79 |
< |
#endif |
72 |
> |
SET_FILE_BINARY(fp); |
73 |
|
if (checkheader(fp, AMBFMT, header ? stdout : (FILE *)NULL) < 0) |
74 |
|
goto formaterr; |
75 |
|
if (!hasambmagic(fp)) |
88 |
|
} |
89 |
|
|
90 |
|
|
91 |
< |
lookamb(fp) /* get ambient values from a file */ |
92 |
< |
FILE *fp; |
91 |
> |
extern void |
92 |
> |
lookamb( /* get ambient values from a file */ |
93 |
> |
FILE *fp |
94 |
> |
) |
95 |
|
{ |
96 |
|
while (readambval(&av, fp)) { |
97 |
|
if (dataonly) { |
125 |
|
} |
126 |
|
|
127 |
|
|
128 |
< |
writamb(fp) /* write binary ambient values */ |
129 |
< |
FILE *fp; |
128 |
> |
extern void |
129 |
> |
writamb( /* write binary ambient values */ |
130 |
> |
FILE *fp |
131 |
> |
) |
132 |
|
{ |
133 |
|
for ( ; ; ) { |
134 |
|
if (!dataonly) |