123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- #ifdef HAVE_CONFIG_H
- # include <config.h>
- #endif
- #ifdef __MINGW32__
- # define SCM_IMPORT 1
- #endif
- #include <libguile.h>
- #ifdef HAVE_CONFIG_H
- #include <libguile/scmconfig.h>
- #endif
- #include <ltdl.h>
- #include <locale.h>
- #ifdef HAVE_WINSOCK2_H
- #include <winsock2.h>
- #endif
- static void
- inner_main (void *closure SCM_UNUSED, int argc, char **argv)
- {
- #ifdef __MINGW32__
-
- WSADATA WSAData;
- WSAStartup (0x0202, &WSAData);
- #endif
-
- scm_shell (argc, argv);
- #ifdef __MINGW32__
- WSACleanup ();
- #endif
- }
- static int
- get_integer_from_environment (const char *var, int def)
- {
- char *end = 0;
- char *val = getenv (var);
- long res = def;
- if (!val)
- return def;
- res = strtol (val, &end, 10);
- if (end == val)
- {
- fprintf (stderr, "guile: warning: invalid %s: %s\n", var, val);
- return def;
- }
- return res;
- }
- static int
- should_install_locale (void)
- {
-
- return get_integer_from_environment ("GUILE_INSTALL_LOCALE", 1);
- }
- int
- main (int argc, char **argv)
- {
-
- if (should_install_locale () && setlocale (LC_ALL, "") == NULL)
- fprintf (stderr, "guile: warning: failed to install locale\n");
- scm_install_gmp_memory_functions = 1;
- scm_boot_guile (argc, argv, inner_main, 0);
- return 0;
- }
|