1 |
– |
/* Copyright (c) 1993 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 |
|
* pcompos.c - program to composite pictures. |
6 |
|
* |
15 |
|
#include <fcntl.h> |
16 |
|
#endif |
17 |
|
|
18 |
+ |
#include <time.h> |
19 |
+ |
|
20 |
|
#include "color.h" |
21 |
|
|
22 |
|
#include "resolu.h" |
57 |
|
|
58 |
|
int nfile; /* number of files */ |
59 |
|
|
60 |
+ |
char ourfmt[LPICFMT+1] = PICFMT; |
61 |
|
int wrongformat = 0; |
62 |
|
|
63 |
< |
FILE *popen(), *lblopen(); |
63 |
> |
FILE *lblopen(); |
64 |
> |
void quit(); |
65 |
|
|
65 |
– |
extern char *malloc(); |
66 |
|
|
67 |
– |
|
67 |
|
tabputs(s) /* print line preceded by a tab */ |
68 |
|
char *s; |
69 |
|
{ |
70 |
|
char fmt[32]; |
71 |
|
|
72 |
< |
if (isformat(s)) { |
73 |
< |
formatval(fmt, s); |
74 |
< |
wrongformat = strcmp(fmt, COLRFMT); |
72 |
> |
if (isheadid(s)) |
73 |
> |
return(0); |
74 |
> |
if (formatval(fmt, s)) { |
75 |
> |
if (globmatch(ourfmt, fmt)) { |
76 |
> |
wrongformat = 0; |
77 |
> |
strcpy(ourfmt, fmt); |
78 |
> |
} else |
79 |
> |
wrongformat = 1; |
80 |
|
} else { |
81 |
|
putc('\t', stdout); |
82 |
|
fputs(s, stdout); |
83 |
|
} |
84 |
+ |
return(0); |
85 |
|
} |
86 |
|
|
87 |
|
|
148 |
|
goto userr; |
149 |
|
} |
150 |
|
dofiles: |
151 |
+ |
newheader("RADIANCE", stdout); |
152 |
+ |
fputnow(stdout); |
153 |
|
for (nfile = 0; an < argc; nfile++) { |
154 |
|
if (nfile >= MAXFILE) |
155 |
|
goto toomany; |
227 |
|
printf("%s:\n", input[nfile].name); |
228 |
|
getheader(input[nfile].fp, tabputs, NULL); |
229 |
|
if (wrongformat) { |
230 |
< |
fprintf(stderr, "%s: not a Radiance picture\n", |
230 |
> |
fprintf(stderr, "%s: incompatible input format\n", |
231 |
|
input[nfile].name); |
232 |
|
quit(1); |
233 |
|
} |
294 |
|
ymax = ysiz; |
295 |
|
/* add new header info. */ |
296 |
|
printargs(argc, argv, stdout); |
297 |
< |
fputformat(COLRFMT, stdout); |
297 |
> |
if (strcmp(ourfmt, PICFMT)) |
298 |
> |
fputformat(ourfmt, stdout); /* print format if known */ |
299 |
|
putchar('\n'); |
300 |
|
fprtresolu(xsiz, ysiz, stdout); |
301 |
|
|
415 |
|
} |
416 |
|
|
417 |
|
|
418 |
+ |
void |
419 |
|
quit(code) /* exit gracefully */ |
420 |
|
int code; |
421 |
|
{ |