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