72 |
|
{ |
73 |
|
int ncolumns = 0; |
74 |
|
int autolabel = 0; |
75 |
< |
int curcol = 0, curx = 0, cury = 0; |
75 |
> |
int curcol = 0, x0 = 0, curx = 0, cury = 0, spacing = 0; |
76 |
|
char *thislabel; |
77 |
|
int an; |
78 |
|
|
81 |
|
for (an = 1; an < argc && argv[an][0] == '-'; an++) |
82 |
|
switch (argv[an][1]) { |
83 |
|
case 'x': |
84 |
< |
xmax = xsiz = atoi(argv[++an]); |
84 |
> |
xsiz = atoi(argv[++an]); |
85 |
|
break; |
86 |
|
case 'y': |
87 |
< |
ymax = ysiz = atoi(argv[++an]); |
87 |
> |
ysiz = atoi(argv[++an]); |
88 |
|
break; |
89 |
|
case 'b': |
90 |
|
setcolr(bgcolr, atof(argv[an+1]), |
95 |
|
case 'a': |
96 |
|
ncolumns = atoi(argv[++an]); |
97 |
|
break; |
98 |
+ |
case 's': |
99 |
+ |
spacing = atoi(argv[++an]); |
100 |
+ |
break; |
101 |
+ |
case 'o': |
102 |
+ |
curx = x0 = atoi(argv[++an]); |
103 |
+ |
cury = atoi(argv[++an]); |
104 |
+ |
break; |
105 |
|
case 'l': |
106 |
|
switch (argv[an][2]) { |
107 |
|
case 'a': |
123 |
|
goto userr; |
124 |
|
} |
125 |
|
dofiles: |
119 |
– |
if (ysiz > 0 & ncolumns > 0) { |
120 |
– |
fprintf(stderr, "%s: -a option incompatible with -y\n", |
121 |
– |
progname); |
122 |
– |
quit(1); |
123 |
– |
} |
126 |
|
for (nfile = 0; an < argc; nfile++) { |
127 |
|
if (nfile >= MAXFILE) |
128 |
|
goto toomany; |
199 |
|
} |
200 |
|
if (ncolumns > 0) { |
201 |
|
if (curcol >= ncolumns) { |
202 |
< |
cury = ymax; |
203 |
< |
curx = 0; |
202 |
> |
cury = ymax + spacing; |
203 |
> |
curx = x0; |
204 |
|
curcol = 0; |
205 |
|
} |
206 |
|
input[nfile].xloc = curx; |
207 |
|
input[nfile].yloc = cury; |
208 |
< |
curx += input[nfile].xres; |
208 |
> |
curx += input[nfile].xres + spacing; |
209 |
|
curcol++; |
210 |
|
} else { |
211 |
|
input[nfile].xloc = atoi(argv[an++]); |
237 |
|
} |
238 |
|
if (xsiz <= 0) |
239 |
|
xsiz = xmax; |
240 |
+ |
else if (xsiz > xmax) |
241 |
+ |
xmax = xsiz; |
242 |
|
if (ysiz <= 0) |
243 |
|
ysiz = ymax; |
244 |
+ |
else if (ysiz > ymax) |
245 |
+ |
ymax = ysiz; |
246 |
|
/* add new header info. */ |
247 |
|
printargs(argc, argv, stdout); |
248 |
|
fputformat(COLRFMT, stdout); |
253 |
|
|
254 |
|
quit(0); |
255 |
|
userr: |
256 |
< |
fprintf(stderr, "Usage: %s [-x xr][-y yr][-b r g b][-a n][-la][-lh h] ", |
256 |
> |
fprintf(stderr, |
257 |
> |
"Usage: %s [-x xr][-y yr][-b r g b][-a n][-s p][-o x0 y0][-la][-lh h] ", |
258 |
|
progname); |
259 |
|
fprintf(stderr, "[-t min1][+t max1][-l lab] pic1 x1 y1 ..\n"); |
260 |
|
quit(1); |
365 |
|
} |
366 |
|
|
367 |
|
|
368 |
< |
quit(code) /* exit gracefully */ |
368 |
> |
#ifdef NIX |
369 |
> |
|
370 |
> |
quit(code) |
371 |
|
int code; |
372 |
|
{ |
373 |
< |
int status; |
373 |
> |
exit(code); |
374 |
> |
} |
375 |
|
|
376 |
< |
if (code == 0) /* reap any children */ |
377 |
< |
while (wait(&status) != -1) |
378 |
< |
if (code == 0) |
379 |
< |
code = status>>8 & 0xff; |
376 |
> |
#else |
377 |
> |
|
378 |
> |
quit(code) /* exit gracefully */ |
379 |
> |
int code; |
380 |
> |
{ |
381 |
> |
register int i; |
382 |
> |
/* close input files */ |
383 |
> |
for (i = 0; i < nfile; i++) |
384 |
> |
fclose(input[i].fp); |
385 |
> |
/* reap any children */ |
386 |
> |
while (wait(0) != -1) |
387 |
> |
; |
388 |
|
exit(code); |
389 |
|
} |
390 |
+ |
|
391 |
+ |
#endif |