1 |
– |
/* Copyright (c) 1986 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 |
|
* psum.c - program to sum pictures. |
6 |
|
* |
8 |
|
*/ |
9 |
|
|
10 |
|
#include <stdio.h> |
11 |
+ |
#include <math.h> |
12 |
|
|
13 |
|
#include "color.h" |
14 |
+ |
#include "resolu.h" |
15 |
+ |
#include "rterror.h" |
16 |
|
|
17 |
|
|
18 |
|
#define MAXFILE 8 |
26 |
|
COLOR scale[MAXFILE]; /* scaling factors */ |
27 |
|
int nfile; /* number of files */ |
28 |
|
|
29 |
+ |
static gethfunc tabputs; |
30 |
|
|
31 |
< |
tabputs(s) /* print line preceded by a tab */ |
32 |
< |
char *s; |
31 |
> |
|
32 |
> |
static int |
33 |
> |
tabputs( /* print line preceded by a tab */ |
34 |
> |
char *s, |
35 |
> |
void *p |
36 |
> |
) |
37 |
|
{ |
38 |
|
putc('\t', stdout); |
39 |
< |
fputs(s, stdout); |
39 |
> |
return(fputs(s, stdout)); |
40 |
|
} |
41 |
|
|
42 |
|
|
44 |
|
int argc; |
45 |
|
char *argv[]; |
46 |
|
{ |
47 |
< |
double d, atof(); |
47 |
> |
double d; |
48 |
|
int xres, yres; |
49 |
|
int an; |
50 |
|
|
99 |
|
/* get header */ |
100 |
|
fputs(fname[nfile], stdout); |
101 |
|
fputs(":\n", stdout); |
102 |
< |
getheader(fptr[nfile], tabputs); |
102 |
> |
getheader(fptr[nfile], tabputs, NULL); |
103 |
|
/* get picture size */ |
104 |
< |
if (fscanf(fptr[nfile], "-Y %d +X %d\n", &yres, &xres) != 2) { |
104 |
> |
if (fgetresolu(&xres, &yres, fptr[nfile]) != (YMAJOR|YDECR)) { |
105 |
|
fprintf(stderr, "%s: bad picture size\n", progname); |
106 |
|
quit(1); |
107 |
|
} else if (nfile == 0) { |
117 |
|
} |
118 |
|
/* add new header info. */ |
119 |
|
printargs(argc, argv, stdout); |
120 |
< |
printf("\n-Y %d +X %d\n", ysiz, xsiz); |
120 |
> |
putchar('\n'); |
121 |
> |
fputresolu(YMAJOR|YDECR, xsiz, ysiz, stdout); |
122 |
|
|
123 |
|
psum(); |
124 |
|
|
157 |
|
quit(1); |
158 |
|
} |
159 |
|
} |
160 |
< |
free((char *)scanin); |
161 |
< |
free((char *)scanout); |
160 |
> |
free((void *)scanin); |
161 |
> |
free((void *)scanout); |
162 |
|
} |
163 |
|
|
164 |
|
|
165 |
+ |
void |
166 |
|
quit(code) /* exit gracefully */ |
167 |
|
int code; |
168 |
|
{ |