| 1 |
< |
/* Copyright (c) 1991 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1992 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 16 |
|
|
| 17 |
|
#include "resolu.h" |
| 18 |
|
|
| 19 |
< |
#define MAXFILE 32 |
| 19 |
> |
#define MAXFILE 64 |
| 20 |
|
|
| 21 |
|
/* output picture size */ |
| 22 |
|
int xsiz = 0; |
| 33 |
|
|
| 34 |
|
int checkthresh = 0; /* check threshold value */ |
| 35 |
|
|
| 36 |
+ |
char Command[] = "<Command>"; |
| 37 |
+ |
char Label[] = "<Label>"; |
| 38 |
+ |
|
| 39 |
|
char *progname; |
| 40 |
|
|
| 41 |
|
struct { |
| 75 |
|
{ |
| 76 |
|
int ncolumns = 0; |
| 77 |
|
int autolabel = 0; |
| 78 |
< |
int curcol = 0, curx = 0, cury = 0; |
| 78 |
> |
int curcol = 0, x0 = 0, curx = 0, cury = 0, spacing = 0; |
| 79 |
|
char *thislabel; |
| 80 |
|
int an; |
| 81 |
|
|
| 84 |
|
for (an = 1; an < argc && argv[an][0] == '-'; an++) |
| 85 |
|
switch (argv[an][1]) { |
| 86 |
|
case 'x': |
| 87 |
< |
xmax = xsiz = atoi(argv[++an]); |
| 87 |
> |
xsiz = atoi(argv[++an]); |
| 88 |
|
break; |
| 89 |
|
case 'y': |
| 90 |
< |
ymax = ysiz = atoi(argv[++an]); |
| 90 |
> |
ysiz = atoi(argv[++an]); |
| 91 |
|
break; |
| 92 |
|
case 'b': |
| 93 |
|
setcolr(bgcolr, atof(argv[an+1]), |
| 98 |
|
case 'a': |
| 99 |
|
ncolumns = atoi(argv[++an]); |
| 100 |
|
break; |
| 101 |
+ |
case 's': |
| 102 |
+ |
spacing = atoi(argv[++an]); |
| 103 |
+ |
break; |
| 104 |
+ |
case 'o': |
| 105 |
+ |
curx = x0 = atoi(argv[++an]); |
| 106 |
+ |
cury = atoi(argv[++an]); |
| 107 |
+ |
break; |
| 108 |
|
case 'l': |
| 109 |
|
switch (argv[an][2]) { |
| 110 |
|
case 'a': |
| 173 |
|
input[nfile].fp = stdin; |
| 174 |
|
} else { |
| 175 |
|
if (argv[an][0] == '!') { |
| 176 |
< |
input[nfile].name = "<Command>"; |
| 176 |
> |
input[nfile].name = Command; |
| 177 |
|
input[nfile].fp = popen(argv[an]+1, "r"); |
| 178 |
|
} else { |
| 179 |
|
input[nfile].name = argv[an]; |
| 202 |
|
} |
| 203 |
|
if (ncolumns > 0) { |
| 204 |
|
if (curcol >= ncolumns) { |
| 205 |
< |
cury = ymax; |
| 206 |
< |
curx = 0; |
| 205 |
> |
cury = ymax + spacing; |
| 206 |
> |
curx = x0; |
| 207 |
|
curcol = 0; |
| 208 |
|
} |
| 209 |
|
input[nfile].xloc = curx; |
| 210 |
|
input[nfile].yloc = cury; |
| 211 |
< |
curx += input[nfile].xres; |
| 211 |
> |
curx += input[nfile].xres + spacing; |
| 212 |
|
curcol++; |
| 213 |
|
} else { |
| 214 |
|
input[nfile].xloc = atoi(argv[an++]); |
| 225 |
|
if (thislabel != NULL) { |
| 226 |
|
if (++nfile >= MAXFILE) |
| 227 |
|
goto toomany; |
| 228 |
< |
input[nfile].name = "<Label>"; |
| 228 |
> |
input[nfile].name = Label; |
| 229 |
|
input[nfile].hasmin = input[nfile].hasmax = 0; |
| 230 |
|
input[nfile].xres = input[nfile-1].xres; |
| 231 |
|
input[nfile].yres = labelht; |
| 240 |
|
} |
| 241 |
|
if (xsiz <= 0) |
| 242 |
|
xsiz = xmax; |
| 243 |
+ |
else if (xsiz > xmax) |
| 244 |
+ |
xmax = xsiz; |
| 245 |
|
if (ysiz <= 0) |
| 246 |
|
ysiz = ymax; |
| 247 |
+ |
else if (ysiz > ymax) |
| 248 |
+ |
ymax = ysiz; |
| 249 |
|
/* add new header info. */ |
| 250 |
|
printargs(argc, argv, stdout); |
| 251 |
|
fputformat(COLRFMT, stdout); |
| 256 |
|
|
| 257 |
|
quit(0); |
| 258 |
|
userr: |
| 259 |
< |
fprintf(stderr, "Usage: %s [-x xr][-y yr][-b r g b][-a n][-la][-lh h] ", |
| 259 |
> |
fprintf(stderr, |
| 260 |
> |
"Usage: %s [-x xr][-y yr][-b r g b][-a n][-s p][-o x0 y0][-la][-lh h] ", |
| 261 |
|
progname); |
| 262 |
|
fprintf(stderr, "[-t min1][+t max1][-l lab] pic1 x1 y1 ..\n"); |
| 263 |
|
quit(1); |
| 371 |
|
quit(code) /* exit gracefully */ |
| 372 |
|
int code; |
| 373 |
|
{ |
| 374 |
+ |
register int i; |
| 375 |
+ |
/* close input files */ |
| 376 |
+ |
for (i = 0; i < nfile; i++) |
| 377 |
+ |
if (input[i].name == Command || input[i].name == Label) |
| 378 |
+ |
pclose(input[i].fp); |
| 379 |
+ |
else |
| 380 |
+ |
fclose(input[i].fp); |
| 381 |
|
exit(code); |
| 382 |
|
} |