| #include <stdlib.h> |
#include <stdlib.h> |
| #include "forth.h" |
#include "forth.h" |
| #include "io.h" |
#include "io.h" |
| |
#ifdef USE_GETOPT |
| #include "getopt.h" |
#include "getopt.h" |
| |
#else |
| |
extern int getopt (argc, argv, optstring); |
| |
|
| |
extern char *optarg; |
| |
extern int optind, opterr; |
| |
#endif |
| |
|
| #ifndef DEFAULTPATH |
#ifndef DEFAULTPATH |
| # define DEFAULTPATH "/usr/local/lib/gforth:." |
# define DEFAULTPATH "/usr/local/lib/gforth:." |
| char *path, *path1; |
char *path, *path1; |
| char *imagename="gforth.fi"; |
char *imagename="gforth.fi"; |
| FILE *image_file; |
FILE *image_file; |
| int c; |
int c, retvalue; |
| |
|
| #if defined(i386) && defined(ALIGNMENT_CHECK) |
#if defined(i386) && defined(ALIGNMENT_CHECK) |
| /* turn on alignment checks on the 486. |
/* turn on alignment checks on the 486. |
| opterr=0; |
opterr=0; |
| while (1) { |
while (1) { |
| int option_index=0; |
int option_index=0; |
| |
#ifdef USE_GETOPT |
| static struct option opts[] = { |
static struct option opts[] = { |
| {"image-file", required_argument, NULL, 'i'}, |
{"image-file", required_argument, NULL, 'i'}, |
| {"dictionary-size", required_argument, NULL, 'm'}, |
{"dictionary-size", required_argument, NULL, 'm'}, |
| }; |
}; |
| |
|
| c = getopt_long(argc, argv, "+drfl", opts, &option_index); |
c = getopt_long(argc, argv, "+drfl", opts, &option_index); |
| |
#else |
| |
c = getopt(argc, argv, "imdrflp"); |
| |
#endif |
| |
|
| if (c==EOF) |
if (c==EOF) |
| break; |
break; |
| if (c=='?') { |
if (c=='?') { |
| for (i=0; i<environ[0]; i++) |
for (i=0; i<environ[0]; i++) |
| printf("%s\n", ((char **)(environ[1]))[i]); |
printf("%s\n", ((char **)(environ[1]))[i]); |
| */ |
*/ |
| exit(go_forth(loader(image_file),3, environ)); |
retvalue=go_forth(loader(image_file),3,environ); |
| |
deprep_terminal(); |
| |
exit(retvalue); |
| } |
} |
| } |
} |