| 9 |
|
* Greg Ward Larson |
| 10 |
|
*/ |
| 11 |
|
|
| 12 |
+ |
#include <stdlib.h> |
| 13 |
|
#include <stdio.h> |
| 14 |
|
|
| 15 |
+ |
#include "rterror.h" |
| 16 |
+ |
#include "mgvars.h" |
| 17 |
+ |
#include "meta.h" |
| 18 |
|
|
| 19 |
|
#define isopt(s) (s[0] == '+' || s[0] == '-') |
| 20 |
|
|
| 22 |
|
|
| 23 |
|
char *libpath[4]; |
| 24 |
|
|
| 25 |
+ |
static void dofile(int optc, char *optv[], char *file); |
| 26 |
|
|
| 27 |
< |
main(argc, argv) |
| 28 |
< |
int argc; |
| 29 |
< |
char *argv[]; |
| 27 |
> |
|
| 28 |
> |
int |
| 29 |
> |
main( |
| 30 |
> |
int argc, |
| 31 |
> |
char *argv[] |
| 32 |
> |
) |
| 33 |
|
{ |
| 26 |
– |
#if UNIX || MAC |
| 34 |
|
char *getenv(); |
| 28 |
– |
#endif |
| 35 |
|
int i, file0; |
| 36 |
|
|
| 31 |
– |
#ifdef CPM |
| 32 |
– |
fixargs("dgraph", &argc, &argv); |
| 37 |
|
progname = argv[0]; |
| 34 |
– |
libpath[0] = ""; |
| 35 |
– |
libpath[1] = "0/"; |
| 36 |
– |
libpath[2] = NULL; |
| 37 |
– |
#endif |
| 38 |
– |
#ifdef MAC |
| 39 |
– |
progname = argv[0]; |
| 38 |
|
libpath[0] = "./"; |
| 39 |
|
if ((libpath[i=1] = getenv("MDIR")) != NULL) |
| 40 |
|
i++; |
| 43 |
– |
libpath[i++] = "/meta/"; |
| 44 |
– |
libpath[i] = NULL; |
| 45 |
– |
#endif |
| 46 |
– |
#ifdef UNIX |
| 47 |
– |
progname = argv[0]; |
| 48 |
– |
libpath[0] = "./"; |
| 49 |
– |
if ((libpath[i=1] = getenv("MDIR")) != NULL) |
| 50 |
– |
i++; |
| 41 |
|
libpath[i++] = "/usr/local/lib/meta/"; |
| 42 |
|
libpath[i] = NULL; |
| 53 |
– |
#endif |
| 43 |
|
|
| 44 |
|
for (file0 = 1; file0 < argc-1; file0 += 2) |
| 45 |
|
if (!isopt(argv[file0])) |
| 52 |
|
dofile(file0-1, argv+1, argv[i]); |
| 53 |
|
|
| 54 |
|
quit(0); |
| 55 |
+ |
return 0; /* pro forma return */ |
| 56 |
|
} |
| 57 |
|
|
| 58 |
|
|
| 59 |
< |
dofile(optc, optv, file) /* plot a file */ |
| 60 |
< |
int optc; |
| 61 |
< |
char *optv[]; |
| 62 |
< |
char *file; |
| 59 |
> |
void |
| 60 |
> |
dofile( /* plot a file */ |
| 61 |
> |
int optc, |
| 62 |
> |
char *optv[], |
| 63 |
> |
char *file |
| 64 |
> |
) |
| 65 |
|
{ |
| 66 |
|
int width = 79; |
| 67 |
|
int length = 21; |
| 95 |
|
} |
| 96 |
|
|
| 97 |
|
|
| 98 |
< |
eputs(msg) /* print error message */ |
| 99 |
< |
char *msg; |
| 98 |
> |
void |
| 99 |
> |
eputs( /* print error message */ |
| 100 |
> |
const char *msg |
| 101 |
> |
) |
| 102 |
|
{ |
| 103 |
|
fputs(msg, stderr); |
| 104 |
|
} |
| 105 |
|
|
| 106 |
|
|
| 107 |
< |
quit(code) /* quit program */ |
| 108 |
< |
int code; |
| 107 |
> |
void |
| 108 |
> |
quit( /* quit program */ |
| 109 |
> |
int code |
| 110 |
> |
) |
| 111 |
|
{ |
| 112 |
|
exit(code); |
| 113 |
|
} |