| 20 |
|
#include "color.h" |
| 21 |
|
#include "resolu.h" |
| 22 |
|
|
| 23 |
< |
#define MAXFILE 512 |
| 23 |
> |
#define MAXFILE 1024 |
| 24 |
|
|
| 25 |
|
#define HASMIN 1 |
| 26 |
|
#define HASMAX 2 |
| 57 |
|
|
| 58 |
|
int nfile; /* number of files */ |
| 59 |
|
|
| 60 |
+ |
int echoheader = 1; |
| 61 |
|
char ourfmt[LPICFMT+1] = PICFMT; |
| 62 |
|
int wrongformat = 0; |
| 63 |
|
|
| 64 |
|
|
| 65 |
< |
static gethfunc tabputs; |
| 65 |
> |
static gethfunc headline; |
| 66 |
|
static void compos(void); |
| 67 |
|
static int cmpcolr(COLR c1, double lv2); |
| 68 |
|
static FILE * lblopen(char *s, int *xp, int *yp); |
| 70 |
|
|
| 71 |
|
|
| 72 |
|
static int |
| 73 |
< |
tabputs( /* print line preceded by a tab */ |
| 73 |
> |
headline( /* print line preceded by a tab */ |
| 74 |
|
char *s, |
| 75 |
|
void *p |
| 76 |
|
) |
| 85 |
|
strcpy(ourfmt, fmt); |
| 86 |
|
} else |
| 87 |
|
wrongformat = 1; |
| 88 |
< |
} else { |
| 88 |
> |
} else if (echoheader) { |
| 89 |
|
putc('\t', stdout); |
| 90 |
|
fputs(s, stdout); |
| 91 |
|
} |
| 112 |
|
|
| 113 |
|
for (an = 1; an < argc && argv[an][0] == '-'; an++) |
| 114 |
|
switch (argv[an][1]) { |
| 115 |
+ |
case 'h': |
| 116 |
+ |
echoheader = !echoheader; |
| 117 |
+ |
break; |
| 118 |
|
case 'x': |
| 119 |
|
xsiz = atoi(argv[++an]); |
| 120 |
|
break; |
| 228 |
|
} |
| 229 |
|
an++; |
| 230 |
|
/* get header */ |
| 231 |
< |
printf("%s:\n", input[nfile].name); |
| 232 |
< |
getheader(input[nfile].fp, tabputs, NULL); |
| 231 |
> |
if (echoheader) |
| 232 |
> |
printf("%s:\n", input[nfile].name); |
| 233 |
> |
getheader(input[nfile].fp, headline, NULL); |
| 234 |
|
if (wrongformat) { |
| 235 |
|
fprintf(stderr, "%s: incompatible input format\n", |
| 236 |
|
input[nfile].name); |
| 243 |
|
input[nfile].name); |
| 244 |
|
quit(1); |
| 245 |
|
} |
| 246 |
< |
if (ncolumns > 0) { |
| 247 |
< |
if (curcol >= ncolumns) { |
| 246 |
> |
if (ncolumns) { |
| 247 |
> |
if (curcol >= abs(ncolumns)) { |
| 248 |
|
cury = ymax + spacing; |
| 249 |
|
curx = x0; |
| 250 |
|
curcol = 0; |
| 297 |
|
ysiz = ymax; |
| 298 |
|
else if (ysiz > ymax) |
| 299 |
|
ymax = ysiz; |
| 300 |
+ |
if (ncolumns < 0) { /* reverse rows if requested */ |
| 301 |
+ |
int i = nfile; |
| 302 |
+ |
while (i--) |
| 303 |
+ |
input[i].yloc = ymax - input[i].yres - input[i].yloc; |
| 304 |
+ |
} |
| 305 |
|
/* add new header info. */ |
| 306 |
|
printargs(argc, argv, stdout); |
| 307 |
|
if (strcmp(ourfmt, PICFMT)) |
| 314 |
|
quit(0); |
| 315 |
|
userr: |
| 316 |
|
fprintf(stderr, |
| 317 |
< |
"Usage: %s [-x xr][-y yr][-b r g b][-a n][-s p][-o x0 y0][-la][-lh h] ", |
| 317 |
> |
"Usage: %s [-h][-x xr][-y yr][-b r g b][-a n][-s p][-o x0 y0][-la][-lh h] ", |
| 318 |
|
progname); |
| 319 |
|
fprintf(stderr, "[-t min1][+t max1][-l lab][=SS] pic1 x1 y1 ..\n"); |
| 320 |
|
quit(1); |