--- ray/src/px/pcompos.c 1993/12/29 09:48:12 2.17 +++ ray/src/px/pcompos.c 2003/02/22 02:07:27 2.21 @@ -1,9 +1,6 @@ -/* Copyright (c) 1993 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: pcompos.c,v 2.21 2003/02/22 02:07:27 greg Exp $"; #endif - /* * pcompos.c - program to composite pictures. * @@ -18,6 +15,8 @@ static char SCCSid[] = "$SunId$ LBL"; #include #endif +#include + #include "color.h" #include "resolu.h" @@ -58,25 +57,31 @@ struct { int nfile; /* number of files */ +char ourfmt[LPICFMT+1] = PICFMT; int wrongformat = 0; -FILE *popen(), *lblopen(); +FILE *lblopen(); +void quit(); -extern char *malloc(); - tabputs(s) /* print line preceded by a tab */ char *s; { char fmt[32]; - if (isformat(s)) { - formatval(fmt, s); - wrongformat = strcmp(fmt, COLRFMT); + if (isheadid(s)) + return(0); + if (formatval(fmt, s)) { + if (globmatch(ourfmt, fmt)) { + wrongformat = 0; + strcpy(ourfmt, fmt); + } else + wrongformat = 1; } else { putc('\t', stdout); fputs(s, stdout); } + return(0); } @@ -143,6 +148,8 @@ char *argv[]; goto userr; } dofiles: + newheader("RADIANCE", stdout); + fputnow(stdout); for (nfile = 0; an < argc; nfile++) { if (nfile >= MAXFILE) goto toomany; @@ -220,7 +227,7 @@ getfile: printf("%s:\n", input[nfile].name); getheader(input[nfile].fp, tabputs, NULL); if (wrongformat) { - fprintf(stderr, "%s: not a Radiance picture\n", + fprintf(stderr, "%s: incompatible input format\n", input[nfile].name); quit(1); } @@ -287,7 +294,8 @@ getfile: ymax = ysiz; /* add new header info. */ printargs(argc, argv, stdout); - fputformat(COLRFMT, stdout); + if (strcmp(ourfmt, PICFMT)) + fputformat(ourfmt, stdout); /* print format if known */ putchar('\n'); fprtresolu(xsiz, ysiz, stdout); @@ -407,6 +415,7 @@ err: } +void quit(code) /* exit gracefully */ int code; {