9 |
|
#include <stdio.h> |
10 |
|
#include <signal.h> |
11 |
|
#include <sys/types.h> |
12 |
+ |
|
13 |
+ |
#include "platform.h" |
14 |
|
#ifndef NON_POSIX /* XXX need abstraction for process management */ |
15 |
|
#include <sys/wait.h> |
16 |
|
#endif |
17 |
|
|
16 |
– |
#include "platform.h" |
18 |
|
#include "standard.h" |
19 |
|
#include "color.h" |
20 |
|
#include "view.h" |
78 |
|
|
79 |
|
char *progname; |
80 |
|
int verbose = 0; |
81 |
+ |
int nowarn = 0; |
82 |
|
unsigned timelim = 0; |
83 |
|
int rvrlim = -1; |
84 |
|
|
109 |
|
while ((rval = expandarg(&argc, &argv, i)) > 0) |
110 |
|
; |
111 |
|
if (rval < 0) { |
112 |
< |
fprintf(stderr, "%s: cannot expand '%s'", |
112 |
> |
fprintf(stderr, "%s: cannot expand '%s'\n", |
113 |
|
argv[0], argv[i]); |
114 |
|
exit(1); |
115 |
|
} |
116 |
|
if (argv[i][0] == '-') |
117 |
|
switch (argv[i][1]) { |
118 |
+ |
case 'w': |
119 |
+ |
if (!argv[i][2]) |
120 |
+ |
nowarn = !nowarn; |
121 |
+ |
else if (argv[i][2] == '+') |
122 |
+ |
nowarn = 0; |
123 |
+ |
else if (argv[i][2] == '-') |
124 |
+ |
nowarn = 1; |
125 |
+ |
break; |
126 |
|
case 'v': |
127 |
|
switch (argv[i][2]) { |
128 |
|
case '\0': /* verbose option */ |
145 |
|
} |
146 |
|
break; |
147 |
|
case 'p': /* pixel aspect ratio? */ |
148 |
+ |
if (argv[i][2] == 'm') { |
149 |
+ |
fprintf(stderr, "%s: -pm unsupported\n", |
150 |
+ |
argv[0]); |
151 |
+ |
++i; |
152 |
+ |
continue; |
153 |
+ |
} |
154 |
|
if (argv[i][2] != 'a' || argv[i][3]) |
155 |
|
break; |
156 |
|
pixaspect = atof(argv[++i]); |
159 |
|
if (argv[i][2]) |
160 |
|
break; |
161 |
|
timelim = atof(argv[++i])*3600. + .5; |
162 |
< |
break; |
162 |
> |
continue; |
163 |
|
case 'x': /* overall x resolution */ |
164 |
|
if (argv[i][2]) |
165 |
|
break; |
204 |
|
break; |
205 |
|
outfile = argv[++i]; |
206 |
|
continue; |
207 |
< |
} else if (i >= argc-1) |
208 |
< |
break; |
207 |
> |
} |
208 |
> |
else if (i >= argc-1) |
209 |
> |
break; |
210 |
|
rpargv[rpargc++] = argv[i]; |
211 |
|
} |
212 |
|
if (i >= argc) { |
263 |
|
sflock(F_UNLCK); |
264 |
|
} |
265 |
|
/* compute piece size */ |
266 |
+ |
hr = hres; vr = vres; |
267 |
+ |
if (pixaspect > FTINY) |
268 |
+ |
normaspect(viewaspect(&ourview), &pixaspect, &hr, &vr); |
269 |
|
hres /= hmult; |
270 |
|
vres /= vmult; |
271 |
|
if (hres <= 0 || vres <= 0) { |
273 |
|
exit(1); |
274 |
|
} |
275 |
|
normaspect(viewaspect(&ourview)*hmult/vmult, &pixaspect, &hres, &vres); |
276 |
+ |
if (!nowarn && (hr != hres*hmult) | (vr != vres*vmult)) |
277 |
+ |
fprintf(stderr, |
278 |
+ |
"%s: warning - resolution changed from %dx%d to %dx%d\n", |
279 |
+ |
progname, hr, vr, hres*hmult, vres*vmult); |
280 |
|
sprintf(hrbuf, "%d", hres); |
281 |
|
rpargv[rpargc++] = "-x"; rpargv[rpargc++] = hrbuf; |
282 |
|
sprintf(vrbuf, "%d", vres); |
295 |
|
fputs(VIEWSTR, fp); |
296 |
|
fprintview(&ourview, fp); |
297 |
|
putc('\n', fp); |
298 |
+ |
fputnow(fp); |
299 |
|
if (pixaspect < .99 || pixaspect > 1.01) |
300 |
|
fputaspect(pixaspect, fp); |
301 |
|
fputformat(COLRFMT, fp); |