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 "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 |
47 |
|
char Command[] = "<Command>"; |
48 |
|
char Label[] = "<Label>"; |
49 |
|
|
47 |
– |
char *progname; |
48 |
– |
|
50 |
|
struct { |
51 |
|
char *name; /* file or command name */ |
52 |
|
FILE *fp; /* stream pointer */ |
59 |
|
int nfile; /* number of files */ |
60 |
|
|
61 |
|
int echoheader = 1; |
62 |
< |
char ourfmt[LPICFMT+1] = PICFMT; |
62 |
> |
char ourfmt[MAXFMTLEN] = PICFMT; |
63 |
|
int wrongformat = 0; |
64 |
+ |
double common_expos = 1.; |
65 |
|
|
66 |
+ |
double this_expos; |
67 |
|
|
68 |
|
static gethfunc headline; |
69 |
|
static void compos(void); |
78 |
|
void *p |
79 |
|
) |
80 |
|
{ |
81 |
< |
char fmt[32]; |
81 |
> |
char fmt[MAXFMTLEN]; |
82 |
|
|
83 |
|
if (isheadid(s)) |
84 |
|
return(0); |
85 |
+ |
if (isexpos(s)) |
86 |
+ |
this_expos *= exposval(s); |
87 |
|
if (formatval(fmt, s)) { |
88 |
|
if (globmatch(ourfmt, fmt)) { |
89 |
|
wrongformat = 0; |
91 |
|
} else |
92 |
|
wrongformat = 1; |
93 |
|
} else if (echoheader) { |
94 |
< |
putc('\t', stdout); |
94 |
> |
fputc('\t', stdout); |
95 |
|
fputs(s, stdout); |
96 |
|
} |
97 |
|
return(0); |
110 |
|
int xsgn, ysgn; |
111 |
|
char *thislabel; |
112 |
|
int an; |
113 |
+ |
|
114 |
|
SET_DEFAULT_BINARY(); |
115 |
|
SET_FILE_BINARY(stdin); |
116 |
|
SET_FILE_BINARY(stdout); |
111 |
– |
progname = argv[0]; |
117 |
|
|
118 |
+ |
fixargv0(argv[0]); /* sets global progname */ |
119 |
+ |
|
120 |
|
for (an = 1; an < argc && argv[an][0] == '-'; an++) |
121 |
|
switch (argv[an][1]) { |
122 |
|
case 'h': |
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'); |