| 7 |
|
* 6/30/87 |
| 8 |
|
*/ |
| 9 |
|
|
| 10 |
– |
#include <stdio.h> |
| 10 |
|
#include <math.h> |
| 12 |
– |
#include <time.h> |
| 13 |
– |
#include <string.h> |
| 11 |
|
|
| 12 |
|
#include "copyright.h" |
| 13 |
|
|
| 14 |
+ |
#include "rtio.h" |
| 15 |
|
#include "platform.h" |
| 16 |
< |
#include "rtprocess.h" |
| 16 |
> |
#include "paths.h" |
| 17 |
|
#include "rterror.h" |
| 18 |
|
#include "color.h" |
| 19 |
|
#include "resolu.h" |
| 20 |
|
|
| 21 |
+ |
#ifdef getc_unlocked /* avoid horrendous overhead of flockfile */ |
| 22 |
+ |
#undef getc |
| 23 |
+ |
#define getc getc_unlocked |
| 24 |
+ |
#endif |
| 25 |
+ |
|
| 26 |
|
#define MAXFILE 1024 |
| 27 |
|
|
| 28 |
|
#define HASMIN 1 |
| 63 |
|
int echoheader = 1; |
| 64 |
|
char ourfmt[LPICFMT+1] = PICFMT; |
| 65 |
|
int wrongformat = 0; |
| 66 |
+ |
double common_expos = 1.; |
| 67 |
|
|
| 68 |
+ |
double this_expos; |
| 69 |
|
|
| 70 |
|
static gethfunc headline; |
| 71 |
|
static void compos(void); |
| 80 |
|
void *p |
| 81 |
|
) |
| 82 |
|
{ |
| 83 |
< |
char fmt[32]; |
| 83 |
> |
char fmt[MAXFMTLEN]; |
| 84 |
|
|
| 85 |
|
if (isheadid(s)) |
| 86 |
|
return(0); |
| 87 |
+ |
if (isexpos(s)) |
| 88 |
+ |
this_expos *= exposval(s); |
| 89 |
|
if (formatval(fmt, s)) { |
| 90 |
|
if (globmatch(ourfmt, fmt)) { |
| 91 |
|
wrongformat = 0; |
| 93 |
|
} else |
| 94 |
|
wrongformat = 1; |
| 95 |
|
} else if (echoheader) { |
| 96 |
< |
putc('\t', stdout); |
| 96 |
> |
fputc('\t', stdout); |
| 97 |
|
fputs(s, stdout); |
| 98 |
|
} |
| 99 |
|
return(0); |
| 237 |
|
/* get header */ |
| 238 |
|
if (echoheader) |
| 239 |
|
printf("%s:\n", input[nfile].name); |
| 240 |
+ |
this_expos = 1; |
| 241 |
|
getheader(input[nfile].fp, headline, NULL); |
| 242 |
+ |
if (!nfile) |
| 243 |
+ |
common_expos = this_expos; |
| 244 |
+ |
else if (common_expos > 0 && |
| 245 |
+ |
fabs(this_expos/common_expos - 1.) > 0.02) |
| 246 |
+ |
common_expos = 0; |
| 247 |
|
if (wrongformat) { |
| 248 |
|
fprintf(stderr, "%s: incompatible input format\n", |
| 249 |
|
input[nfile].name); |
| 317 |
|
} |
| 318 |
|
/* add new header info. */ |
| 319 |
|
printargs(argc, argv, stdout); |
| 320 |
+ |
if (common_expos > 0) /* print exposure if shared */ |
| 321 |
+ |
fputexpos(common_expos, stdout); |
| 322 |
|
if (strcmp(ourfmt, PICFMT)) |
| 323 |
|
fputformat(ourfmt, stdout); /* print format if known */ |
| 324 |
|
putchar('\n'); |