9 |
|
* Greg Ward Larson |
10 |
|
*/ |
11 |
|
|
12 |
+ |
#include <stdlib.h> |
13 |
|
#include <stdio.h> |
14 |
|
|
15 |
+ |
#include "rterror.h" |
16 |
+ |
#include "meta.h" |
17 |
+ |
#include "mgvars.h" |
18 |
+ |
|
19 |
|
#define istyp(s) (s[0] == '-') |
20 |
|
|
21 |
|
#define isvar(s) (s[0] == '+') |
24 |
|
|
25 |
|
char *libpath[4]; |
26 |
|
|
27 |
+ |
static void dofile(int optc, char *optv[], char *file); |
28 |
|
|
29 |
< |
main(argc, argv) |
30 |
< |
int argc; |
31 |
< |
char *argv[]; |
29 |
> |
int |
30 |
> |
main( |
31 |
> |
int argc, |
32 |
> |
char *argv[] |
33 |
> |
) |
34 |
|
{ |
27 |
– |
#if UNIX || MAC |
35 |
|
char *getenv(); |
29 |
– |
#endif |
36 |
|
int i, file0; |
37 |
|
|
32 |
– |
#ifdef CPM |
33 |
– |
fixargs("gcomp", &argc, &argv); |
38 |
|
progname = argv[0]; |
35 |
– |
libpath[0] = ""; |
36 |
– |
libpath[1] = "0/"; |
37 |
– |
libpath[2] = NULL; |
38 |
– |
#endif |
39 |
– |
#ifdef MAC |
40 |
– |
progname = argv[0]; |
39 |
|
libpath[0] = "./"; |
40 |
|
if ((libpath[i=1] = getenv("MDIR")) != NULL) |
41 |
|
i++; |
44 |
– |
libpath[i++] = "/meta/"; |
45 |
– |
libpath[i] = NULL; |
46 |
– |
#endif |
47 |
– |
#ifdef UNIX |
48 |
– |
progname = argv[0]; |
49 |
– |
libpath[0] = "./"; |
50 |
– |
if ((libpath[i=1] = getenv("MDIR")) != NULL) |
51 |
– |
i++; |
42 |
|
libpath[i++] = MDIR; |
43 |
|
libpath[i] = NULL; |
54 |
– |
#endif |
44 |
|
|
45 |
|
for (file0 = 1; file0 < argc; ) |
46 |
|
if (istyp(argv[file0])) |
57 |
|
dofile(file0-1, argv+1, argv[i]); |
58 |
|
|
59 |
|
quit(0); |
60 |
+ |
return 0; /* pro forma return */ |
61 |
|
} |
62 |
|
|
63 |
|
|
64 |
< |
dofile(optc, optv, file) /* plot a file */ |
65 |
< |
int optc; |
66 |
< |
char *optv[]; |
67 |
< |
char *file; |
64 |
> |
void |
65 |
> |
dofile( /* plot a file */ |
66 |
> |
int optc, |
67 |
> |
char *optv[], |
68 |
> |
char *file |
69 |
> |
) |
70 |
|
{ |
71 |
|
char types[16], stmp[256], *strcat(); |
72 |
|
int i; |
89 |
|
} |
90 |
|
|
91 |
|
|
92 |
< |
eputs(msg) /* print error message */ |
93 |
< |
char *msg; |
92 |
> |
void |
93 |
> |
eputs( /* print error message */ |
94 |
> |
char *msg |
95 |
> |
) |
96 |
|
{ |
97 |
|
fputs(msg, stderr); |
98 |
|
} |
99 |
|
|
100 |
|
|
101 |
< |
quit(code) /* quit program */ |
102 |
< |
int code; |
101 |
> |
void |
102 |
> |
quit( /* quit program */ |
103 |
> |
int code |
104 |
> |
) |
105 |
|
{ |
106 |
|
exit(code); |
107 |
|
} |