summaryrefslogtreecommitdiffhomepage
path: root/mixguile/mixguile_main.c
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-09-24 23:27:42 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-09-24 23:27:42 +0000
commit86d1cf841a8f8f5aa5165bd1532b9d8909d0c34f (patch)
tree422646178cd6af39b09689c665ea76bb96853d85 /mixguile/mixguile_main.c
parent5a038d4871e9b94ae557ca3676778f864e96b4ef (diff)
downloadmdk-86d1cf841a8f8f5aa5165bd1532b9d8909d0c34f.tar.gz
mdk-86d1cf841a8f8f5aa5165bd1532b9d8909d0c34f.tar.bz2
optionally load local startup file
Diffstat (limited to 'mixguile/mixguile_main.c')
-rw-r--r--mixguile/mixguile_main.c60
1 files changed, 57 insertions, 3 deletions
diff --git a/mixguile/mixguile_main.c b/mixguile/mixguile_main.c
index 183dfaf..fca0664 100644
--- a/mixguile/mixguile_main.c
+++ b/mixguile/mixguile_main.c
@@ -1,7 +1,7 @@
/* -*-c-*- -------------- mixguile_main.c :
* Main function for mixguile, the MIX Guile shell
* ------------------------------------------------------------------
- * Last change: Time-stamp: "01/08/22 01:20:01 jao"
+ * $Id: mixguile_main.c,v 1.4 2001/09/24 23:28:03 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001 Free Software Foundation, Inc.
*
@@ -25,19 +25,73 @@
#include <stdio.h>
#include "mixguile.h"
+
+#ifdef HAVE_GETOPT_LONG
+# include <getopt.h>
+#else
+# include <lib/getopt.h>
+#endif /* HAVE_GETOPT_LONG */
+
+enum {
+ VER_OPT = 'v',
+ NOINIT_OPT = 'q',
+};
+
+static const char *options_ = "vq";
+
+static struct option long_options_[] =
+{
+ {"version", no_argument, 0, VER_OPT},
+ {0, 0, 0, 0}
+};
+
int
main (int argc, char *argv[])
{
const gchar *CONFIG_FILE = "mixvm.config";
mix_config_t *config;
mix_vm_cmd_dispatcher_t *dis;
-
+ int c;
+
+ const char *prog_name = argv[0];
+ gboolean initfile = TRUE;
+
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
+ /* prevent getopt printing a message for unknown options (stored in optopt) */
+ opterr = 0;
+
+ while (1)
+ {
+ c = getopt_long (argc, argv, options_, long_options_, (int*)0);
+
+ /* Detect the end of the options. */
+ if (c == -1)
+ break;
+
+ switch (c)
+ {
+ case VER_OPT:
+ fprintf (stderr, _("%s %s, Scheme MIX Virtual Machine.\n"),
+ prog_name, VERSION);
+ fprintf (stderr, MIX_GPL_LICENSE);
+ return EXIT_SUCCESS;
+ case NOINIT_OPT:
+ initfile = FALSE;
+ break;
+ default:
+ /* let guile try to understand the option */
+ break;
+ }
+ }
mix_init_lib ();
config = mix_config_new (NULL, CONFIG_FILE);
dis = mix_vm_cmd_dispatcher_new_with_config (stdout, stderr, config);
- mixguile_init (argc, argv, mixguile_enter_repl, dis);
+ mixguile_init (argc, argv, initfile, mixguile_enter_repl, dis);
return EXIT_SUCCESS; /* never reached */
}