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" |
18 |
– |
#include "paths.h" |
16 |
|
#include "rterror.h" |
17 |
|
#include "color.h" |
18 |
|
#include "resolu.h" |
46 |
|
char Command[] = "<Command>"; |
47 |
|
char Label[] = "<Label>"; |
48 |
|
|
52 |
– |
char *progname; |
53 |
– |
|
49 |
|
struct { |
50 |
|
char *name; /* file or command name */ |
51 |
|
FILE *fp; /* stream pointer */ |
58 |
|
int nfile; /* number of files */ |
59 |
|
|
60 |
|
int echoheader = 1; |
61 |
< |
char ourfmt[LPICFMT+1] = PICFMT; |
61 |
> |
char ourfmt[MAXFMTLEN] = PICFMT; |
62 |
|
int wrongformat = 0; |
63 |
+ |
double common_expos = 1.; |
64 |
|
|
65 |
+ |
double this_expos; |
66 |
|
|
67 |
|
static gethfunc headline; |
68 |
|
static void compos(void); |
81 |
|
|
82 |
|
if (isheadid(s)) |
83 |
|
return(0); |
84 |
+ |
if (isexpos(s)) |
85 |
+ |
this_expos *= exposval(s); |
86 |
|
if (formatval(fmt, s)) { |
87 |
|
if (globmatch(ourfmt, fmt)) { |
88 |
|
wrongformat = 0; |
109 |
|
int xsgn, ysgn; |
110 |
|
char *thislabel; |
111 |
|
int an; |
112 |
+ |
|
113 |
|
SET_DEFAULT_BINARY(); |
114 |
|
SET_FILE_BINARY(stdin); |
115 |
|
SET_FILE_BINARY(stdout); |
116 |
– |
progname = argv[0]; |
116 |
|
|
117 |
+ |
fixargv0(argv[0]); /* sets global progname */ |
118 |
+ |
|
119 |
|
for (an = 1; an < argc && argv[an][0] == '-'; an++) |
120 |
|
switch (argv[an][1]) { |
121 |
|
case 'h': |
236 |
|
/* get header */ |
237 |
|
if (echoheader) |
238 |
|
printf("%s:\n", input[nfile].name); |
239 |
+ |
this_expos = 1; |
240 |
|
getheader(input[nfile].fp, headline, NULL); |
241 |
+ |
if (!nfile) |
242 |
+ |
common_expos = this_expos; |
243 |
+ |
else if (common_expos > 0 && |
244 |
+ |
fabs(this_expos/common_expos - 1.) > 0.02) |
245 |
+ |
common_expos = 0; |
246 |
|
if (wrongformat) { |
247 |
|
fprintf(stderr, "%s: incompatible input format\n", |
248 |
|
input[nfile].name); |
316 |
|
} |
317 |
|
/* add new header info. */ |
318 |
|
printargs(argc, argv, stdout); |
319 |
+ |
if (common_expos > 0) /* print exposure if shared */ |
320 |
+ |
fputexpos(common_expos, stdout); |
321 |
|
if (strcmp(ourfmt, PICFMT)) |
322 |
|
fputformat(ourfmt, stdout); /* print format if known */ |
323 |
|
putchar('\n'); |