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 |
27 |
|
int nfile; /* number of files */ |
28 |
|
|
29 |
|
|
30 |
+ |
int |
31 |
|
tabputs(s) /* print line preceded by a tab */ |
32 |
|
char *s; |
33 |
|
{ |
34 |
|
putc('\t', stdout); |
35 |
< |
fputs(s, stdout); |
35 |
> |
return(fputs(s, stdout)); |
36 |
|
} |
37 |
|
|
38 |
|
|
40 |
|
int argc; |
41 |
|
char *argv[]; |
42 |
|
{ |
43 |
< |
double d, atof(); |
43 |
> |
double d; |
44 |
|
int xres, yres; |
45 |
|
int an; |
46 |
|
|
95 |
|
/* get header */ |
96 |
|
fputs(fname[nfile], stdout); |
97 |
|
fputs(":\n", stdout); |
98 |
< |
getheader(fptr[nfile], tabputs); |
98 |
> |
getheader(fptr[nfile], tabputs, NULL); |
99 |
|
/* get picture size */ |
100 |
< |
if (fscanf(fptr[nfile], "-Y %d +X %d\n", &yres, &xres) != 2) { |
100 |
> |
if (fgetresolu(&xres, &yres, fptr[nfile]) != (YMAJOR|YDECR)) { |
101 |
|
fprintf(stderr, "%s: bad picture size\n", progname); |
102 |
|
quit(1); |
103 |
|
} else if (nfile == 0) { |
113 |
|
} |
114 |
|
/* add new header info. */ |
115 |
|
printargs(argc, argv, stdout); |
116 |
< |
printf("\n-Y %d +X %d\n", ysiz, xsiz); |
116 |
> |
putchar('\n'); |
117 |
> |
fputresolu(YMAJOR|YDECR, xsiz, ysiz, stdout); |
118 |
|
|
119 |
|
psum(); |
120 |
|
|
153 |
|
quit(1); |
154 |
|
} |
155 |
|
} |
156 |
< |
free((char *)scanin); |
157 |
< |
free((char *)scanout); |
156 |
> |
free((void *)scanin); |
157 |
> |
free((void *)scanout); |
158 |
|
} |
159 |
|
|
160 |
|
|
161 |
+ |
void |
162 |
|
quit(code) /* exit gracefully */ |
163 |
|
int code; |
164 |
|
{ |