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"; |
12 |
|
|
13 |
|
#include <stdio.h> |
14 |
|
|
15 |
+ |
#ifdef MSDOS |
16 |
+ |
#include <fcntl.h> |
17 |
+ |
#endif |
18 |
+ |
|
19 |
|
#include "color.h" |
20 |
|
|
21 |
|
#include "resolu.h" |
22 |
|
|
23 |
< |
#define MAXFILE 64 |
23 |
> |
#define MAXFILE 64 |
24 |
|
|
25 |
|
/* output picture size */ |
26 |
|
int xsiz = 0; |
37 |
|
|
38 |
|
int checkthresh = 0; /* check threshold value */ |
39 |
|
|
40 |
+ |
char Command[] = "<Command>"; |
41 |
+ |
char Label[] = "<Label>"; |
42 |
+ |
|
43 |
|
char *progname; |
44 |
|
|
45 |
|
struct { |
57 |
|
|
58 |
|
FILE *popen(), *lblopen(); |
59 |
|
|
60 |
+ |
extern char *malloc(); |
61 |
|
|
62 |
+ |
|
63 |
|
tabputs(s) /* print line preceded by a tab */ |
64 |
|
char *s; |
65 |
|
{ |
84 |
|
int curcol = 0, x0 = 0, curx = 0, cury = 0, spacing = 0; |
85 |
|
char *thislabel; |
86 |
|
int an; |
87 |
< |
|
87 |
> |
#ifdef MSDOS |
88 |
> |
extern int _fmode; |
89 |
> |
_fmode = O_BINARY; |
90 |
> |
setmode(fileno(stdin), O_BINARY); |
91 |
> |
setmode(fileno(stdout), O_BINARY); |
92 |
> |
#endif |
93 |
|
progname = argv[0]; |
94 |
|
|
95 |
|
for (an = 1; an < argc && argv[an][0] == '-'; an++) |
184 |
|
input[nfile].fp = stdin; |
185 |
|
} else { |
186 |
|
if (argv[an][0] == '!') { |
187 |
< |
input[nfile].name = "<Command>"; |
187 |
> |
input[nfile].name = Command; |
188 |
|
input[nfile].fp = popen(argv[an]+1, "r"); |
189 |
|
} else { |
190 |
|
input[nfile].name = argv[an]; |
236 |
|
if (thislabel != NULL) { |
237 |
|
if (++nfile >= MAXFILE) |
238 |
|
goto toomany; |
239 |
< |
input[nfile].name = "<Label>"; |
239 |
> |
input[nfile].name = Label; |
240 |
|
input[nfile].hasmin = input[nfile].hasmax = 0; |
241 |
|
input[nfile].xres = input[nfile-1].xres; |
242 |
|
input[nfile].yres = labelht; |
379 |
|
} |
380 |
|
|
381 |
|
|
368 |
– |
#ifdef NIX |
369 |
– |
|
370 |
– |
quit(code) |
371 |
– |
int code; |
372 |
– |
{ |
373 |
– |
exit(code); |
374 |
– |
} |
375 |
– |
|
376 |
– |
#else |
377 |
– |
|
382 |
|
quit(code) /* exit gracefully */ |
383 |
|
int code; |
384 |
|
{ |
385 |
|
register int i; |
386 |
|
/* close input files */ |
387 |
|
for (i = 0; i < nfile; i++) |
388 |
< |
fclose(input[i].fp); |
389 |
< |
/* reap any children */ |
390 |
< |
while (wait(0) != -1) |
391 |
< |
; |
388 |
> |
if (input[i].name == Command || input[i].name == Label) |
389 |
> |
pclose(input[i].fp); |
390 |
> |
else |
391 |
> |
fclose(input[i].fp); |
392 |
|
exit(code); |
393 |
|
} |
390 |
– |
|
391 |
– |
#endif |