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