7 |
|
* 6/30/87 |
8 |
|
*/ |
9 |
|
|
10 |
– |
#include <stdio.h> |
10 |
|
#include <math.h> |
12 |
– |
#include <time.h> |
13 |
– |
#include <string.h> |
11 |
|
|
12 |
|
#include "copyright.h" |
13 |
|
|
14 |
+ |
#include "rtio.h" |
15 |
|
#include "platform.h" |
16 |
< |
#include "rtprocess.h" |
16 |
> |
#include "paths.h" |
17 |
|
#include "rterror.h" |
18 |
|
#include "color.h" |
19 |
|
#include "resolu.h" |
20 |
|
|
21 |
< |
#define MAXFILE 512 |
21 |
> |
#ifdef getc_unlocked /* avoid horrendous overhead of flockfile */ |
22 |
> |
#undef getc |
23 |
> |
#define getc getc_unlocked |
24 |
> |
#endif |
25 |
|
|
26 |
+ |
#define MAXFILE 1024 |
27 |
+ |
|
28 |
|
#define HASMIN 1 |
29 |
|
#define HASMAX 2 |
30 |
|
|
60 |
|
|
61 |
|
int nfile; /* number of files */ |
62 |
|
|
63 |
+ |
int echoheader = 1; |
64 |
|
char ourfmt[LPICFMT+1] = PICFMT; |
65 |
|
int wrongformat = 0; |
66 |
|
|
67 |
|
|
68 |
< |
static gethfunc tabputs; |
68 |
> |
static gethfunc headline; |
69 |
|
static void compos(void); |
70 |
|
static int cmpcolr(COLR c1, double lv2); |
71 |
|
static FILE * lblopen(char *s, int *xp, int *yp); |
73 |
|
|
74 |
|
|
75 |
|
static int |
76 |
< |
tabputs( /* print line preceded by a tab */ |
76 |
> |
headline( /* print line preceded by a tab */ |
77 |
|
char *s, |
78 |
|
void *p |
79 |
|
) |
80 |
|
{ |
81 |
< |
char fmt[32]; |
81 |
> |
char fmt[MAXFMTLEN]; |
82 |
|
|
83 |
|
if (isheadid(s)) |
84 |
|
return(0); |
88 |
|
strcpy(ourfmt, fmt); |
89 |
|
} else |
90 |
|
wrongformat = 1; |
91 |
< |
} else { |
92 |
< |
putc('\t', stdout); |
91 |
> |
} else if (echoheader) { |
92 |
> |
fputc('\t', stdout); |
93 |
|
fputs(s, stdout); |
94 |
|
} |
95 |
|
return(0); |
115 |
|
|
116 |
|
for (an = 1; an < argc && argv[an][0] == '-'; an++) |
117 |
|
switch (argv[an][1]) { |
118 |
+ |
case 'h': |
119 |
+ |
echoheader = !echoheader; |
120 |
+ |
break; |
121 |
|
case 'x': |
122 |
|
xsiz = atoi(argv[++an]); |
123 |
|
break; |
231 |
|
} |
232 |
|
an++; |
233 |
|
/* get header */ |
234 |
< |
printf("%s:\n", input[nfile].name); |
235 |
< |
getheader(input[nfile].fp, tabputs, NULL); |
234 |
> |
if (echoheader) |
235 |
> |
printf("%s:\n", input[nfile].name); |
236 |
> |
getheader(input[nfile].fp, headline, NULL); |
237 |
|
if (wrongformat) { |
238 |
|
fprintf(stderr, "%s: incompatible input format\n", |
239 |
|
input[nfile].name); |
246 |
|
input[nfile].name); |
247 |
|
quit(1); |
248 |
|
} |
249 |
< |
if (ncolumns > 0) { |
250 |
< |
if (curcol >= ncolumns) { |
249 |
> |
if (ncolumns) { |
250 |
> |
if (curcol >= abs(ncolumns)) { |
251 |
|
cury = ymax + spacing; |
252 |
|
curx = x0; |
253 |
|
curcol = 0; |
300 |
|
ysiz = ymax; |
301 |
|
else if (ysiz > ymax) |
302 |
|
ymax = ysiz; |
303 |
+ |
if (ncolumns < 0) { /* reverse rows if requested */ |
304 |
+ |
int i = nfile; |
305 |
+ |
while (i--) |
306 |
+ |
input[i].yloc = ymax - input[i].yres - input[i].yloc; |
307 |
+ |
} |
308 |
|
/* add new header info. */ |
309 |
|
printargs(argc, argv, stdout); |
310 |
|
if (strcmp(ourfmt, PICFMT)) |
317 |
|
quit(0); |
318 |
|
userr: |
319 |
|
fprintf(stderr, |
320 |
< |
"Usage: %s [-x xr][-y yr][-b r g b][-a n][-s p][-o x0 y0][-la][-lh h] ", |
320 |
> |
"Usage: %s [-h][-x xr][-y yr][-b r g b][-a n][-s p][-o x0 y0][-la][-lh h] ", |
321 |
|
progname); |
322 |
|
fprintf(stderr, "[-t min1][+t max1][-l lab][=SS] pic1 x1 y1 ..\n"); |
323 |
|
quit(1); |