2011-11-22 12:11:48 +01:00
|
|
|
/* Copyright (C) 1996, 1997, 2000, 2001, 2006, 2008,
|
2011-11-22 12:11:48 +01:00
|
|
|
* 2011, 2013 Free Software Foundation, Inc.
|
2011-11-22 12:11:48 +01:00
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
2009-06-17 00:22:09 +01:00
|
|
|
* modify it under the terms of the GNU Lesser General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 3 of
|
|
|
|
|
* the License, or (at your option) any later version.
|
Move most of the guts of shell command processing into libguile,
so guile.c can be very small (and eventuallly auto-generated. (I
mean, generated mechanically, not self-generated. Hmm.))
* guile.c, script.c, script.h: New source files.
* init.c (scm_boot_guile_1): Call scm_init_script.
* libguile.h: #include "script.h".
* Makefile.am (bin_PROGRAMS, guile_SOURCES, guile_LDADD): New
targets, for new executable.
(libguile_la_SOURCES): Mention script.c.
(modinclude_HEADERS): Add script.h.
* configure.in: Always check for -lm, -lsocket, -lnsl, whether or
not dynamic linking is enabled. This is because we're generating
executables now. Move CY_AC_WITH_THREADS call after those, so the
values of cy_cv_threads_libs captures the libs chosen above.
* Makefile.in, configure, aclocal.m4: Regenerated.
1997-04-19 13:25:21 +00:00
|
|
|
*
|
2009-06-17 00:22:09 +01:00
|
|
|
* This library is distributed in the hope that it will be useful, but
|
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
2003-04-05 19:15:35 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
Move most of the guts of shell command processing into libguile,
so guile.c can be very small (and eventuallly auto-generated. (I
mean, generated mechanically, not self-generated. Hmm.))
* guile.c, script.c, script.h: New source files.
* init.c (scm_boot_guile_1): Call scm_init_script.
* libguile.h: #include "script.h".
* Makefile.am (bin_PROGRAMS, guile_SOURCES, guile_LDADD): New
targets, for new executable.
(libguile_la_SOURCES): Mention script.c.
(modinclude_HEADERS): Add script.h.
* configure.in: Always check for -lm, -lsocket, -lnsl, whether or
not dynamic linking is enabled. This is because we're generating
executables now. Move CY_AC_WITH_THREADS call after those, so the
values of cy_cv_threads_libs captures the libs chosen above.
* Makefile.in, configure, aclocal.m4: Regenerated.
1997-04-19 13:25:21 +00:00
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2009-06-17 00:22:09 +01:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
|
* 02110-1301 USA
|
2003-04-05 19:15:35 +00:00
|
|
|
*/
|
Move most of the guts of shell command processing into libguile,
so guile.c can be very small (and eventuallly auto-generated. (I
mean, generated mechanically, not self-generated. Hmm.))
* guile.c, script.c, script.h: New source files.
* init.c (scm_boot_guile_1): Call scm_init_script.
* libguile.h: #include "script.h".
* Makefile.am (bin_PROGRAMS, guile_SOURCES, guile_LDADD): New
targets, for new executable.
(libguile_la_SOURCES): Mention script.c.
(modinclude_HEADERS): Add script.h.
* configure.in: Always check for -lm, -lsocket, -lnsl, whether or
not dynamic linking is enabled. This is because we're generating
executables now. Move CY_AC_WITH_THREADS call after those, so the
values of cy_cv_threads_libs captures the libs chosen above.
* Makefile.in, configure, aclocal.m4: Regenerated.
1997-04-19 13:25:21 +00:00
|
|
|
|
|
|
|
|
/* This is the 'main' function for the `guile' executable. It is not
|
|
|
|
|
included in libguile.a.
|
|
|
|
|
|
|
|
|
|
Eventually, we hope this file will be automatically generated,
|
|
|
|
|
based on the list of installed, statically linked libraries on the
|
|
|
|
|
system. For now, please don't put interesting code in here. */
|
|
|
|
|
|
2008-09-13 15:35:27 +02:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2003-03-25 23:56:27 +00:00
|
|
|
# include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-11-02 00:15:53 +00:00
|
|
|
#ifdef __MINGW32__
|
2001-11-04 15:52:30 +00:00
|
|
|
# define SCM_IMPORT 1
|
2001-11-02 00:15:53 +00:00
|
|
|
#endif
|
Move most of the guts of shell command processing into libguile,
so guile.c can be very small (and eventuallly auto-generated. (I
mean, generated mechanically, not self-generated. Hmm.))
* guile.c, script.c, script.h: New source files.
* init.c (scm_boot_guile_1): Call scm_init_script.
* libguile.h: #include "script.h".
* Makefile.am (bin_PROGRAMS, guile_SOURCES, guile_LDADD): New
targets, for new executable.
(libguile_la_SOURCES): Mention script.c.
(modinclude_HEADERS): Add script.h.
* configure.in: Always check for -lm, -lsocket, -lnsl, whether or
not dynamic linking is enabled. This is because we're generating
executables now. Move CY_AC_WITH_THREADS call after those, so the
values of cy_cv_threads_libs captures the libs chosen above.
* Makefile.in, configure, aclocal.m4: Regenerated.
1997-04-19 13:25:21 +00:00
|
|
|
#include <libguile.h>
|
|
|
|
|
|
2000-01-10 00:37:47 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2000-04-21 14:16:44 +00:00
|
|
|
#include <libguile/scmconfig.h>
|
2000-01-10 00:37:47 +00:00
|
|
|
#endif
|
2004-10-22 13:01:59 +00:00
|
|
|
#include <ltdl.h>
|
2011-11-22 12:11:48 +01:00
|
|
|
#include <locale.h>
|
2000-01-10 00:37:47 +00:00
|
|
|
|
2002-07-10 19:40:43 +00:00
|
|
|
#ifdef HAVE_WINSOCK2_H
|
2001-06-26 17:53:09 +00:00
|
|
|
#include <winsock2.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
Move most of the guts of shell command processing into libguile,
so guile.c can be very small (and eventuallly auto-generated. (I
mean, generated mechanically, not self-generated. Hmm.))
* guile.c, script.c, script.h: New source files.
* init.c (scm_boot_guile_1): Call scm_init_script.
* libguile.h: #include "script.h".
* Makefile.am (bin_PROGRAMS, guile_SOURCES, guile_LDADD): New
targets, for new executable.
(libguile_la_SOURCES): Mention script.c.
(modinclude_HEADERS): Add script.h.
* configure.in: Always check for -lm, -lsocket, -lnsl, whether or
not dynamic linking is enabled. This is because we're generating
executables now. Move CY_AC_WITH_THREADS call after those, so the
values of cy_cv_threads_libs captures the libs chosen above.
* Makefile.in, configure, aclocal.m4: Regenerated.
1997-04-19 13:25:21 +00:00
|
|
|
static void
|
2001-06-07 21:12:19 +00:00
|
|
|
inner_main (void *closure SCM_UNUSED, int argc, char **argv)
|
Move most of the guts of shell command processing into libguile,
so guile.c can be very small (and eventuallly auto-generated. (I
mean, generated mechanically, not self-generated. Hmm.))
* guile.c, script.c, script.h: New source files.
* init.c (scm_boot_guile_1): Call scm_init_script.
* libguile.h: #include "script.h".
* Makefile.am (bin_PROGRAMS, guile_SOURCES, guile_LDADD): New
targets, for new executable.
(libguile_la_SOURCES): Mention script.c.
(modinclude_HEADERS): Add script.h.
* configure.in: Always check for -lm, -lsocket, -lnsl, whether or
not dynamic linking is enabled. This is because we're generating
executables now. Move CY_AC_WITH_THREADS call after those, so the
values of cy_cv_threads_libs captures the libs chosen above.
* Makefile.in, configure, aclocal.m4: Regenerated.
1997-04-19 13:25:21 +00:00
|
|
|
{
|
2001-06-26 17:53:09 +00:00
|
|
|
#ifdef __MINGW32__
|
|
|
|
|
/* This is necessary to startup the Winsock API under Win32. */
|
|
|
|
|
WSADATA WSAData;
|
|
|
|
|
WSAStartup (0x0202, &WSAData);
|
|
|
|
|
#endif /* __MINGW32__ */
|
|
|
|
|
|
Move most of the guts of shell command processing into libguile,
so guile.c can be very small (and eventuallly auto-generated. (I
mean, generated mechanically, not self-generated. Hmm.))
* guile.c, script.c, script.h: New source files.
* init.c (scm_boot_guile_1): Call scm_init_script.
* libguile.h: #include "script.h".
* Makefile.am (bin_PROGRAMS, guile_SOURCES, guile_LDADD): New
targets, for new executable.
(libguile_la_SOURCES): Mention script.c.
(modinclude_HEADERS): Add script.h.
* configure.in: Always check for -lm, -lsocket, -lnsl, whether or
not dynamic linking is enabled. This is because we're generating
executables now. Move CY_AC_WITH_THREADS call after those, so the
values of cy_cv_threads_libs captures the libs chosen above.
* Makefile.in, configure, aclocal.m4: Regenerated.
1997-04-19 13:25:21 +00:00
|
|
|
/* module initializations would go here */
|
|
|
|
|
scm_shell (argc, argv);
|
2001-06-26 17:53:09 +00:00
|
|
|
|
|
|
|
|
#ifdef __MINGW32__
|
|
|
|
|
WSACleanup ();
|
|
|
|
|
#endif /* __MINGW32__ */
|
Move most of the guts of shell command processing into libguile,
so guile.c can be very small (and eventuallly auto-generated. (I
mean, generated mechanically, not self-generated. Hmm.))
* guile.c, script.c, script.h: New source files.
* init.c (scm_boot_guile_1): Call scm_init_script.
* libguile.h: #include "script.h".
* Makefile.am (bin_PROGRAMS, guile_SOURCES, guile_LDADD): New
targets, for new executable.
(libguile_la_SOURCES): Mention script.c.
(modinclude_HEADERS): Add script.h.
* configure.in: Always check for -lm, -lsocket, -lnsl, whether or
not dynamic linking is enabled. This is because we're generating
executables now. Move CY_AC_WITH_THREADS call after those, so the
values of cy_cv_threads_libs captures the libs chosen above.
* Makefile.in, configure, aclocal.m4: Regenerated.
1997-04-19 13:25:21 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-22 12:11:48 +01:00
|
|
|
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)
|
|
|
|
|
{
|
2013-03-28 05:09:53 -04:00
|
|
|
/* If the GUILE_INSTALL_LOCALE environment variable is unset,
|
|
|
|
|
or set to a nonzero value, we should install the locale via
|
|
|
|
|
setlocale(). */
|
|
|
|
|
return get_integer_from_environment ("GUILE_INSTALL_LOCALE", 1);
|
2011-11-22 12:11:48 +01:00
|
|
|
}
|
|
|
|
|
|
Move most of the guts of shell command processing into libguile,
so guile.c can be very small (and eventuallly auto-generated. (I
mean, generated mechanically, not self-generated. Hmm.))
* guile.c, script.c, script.h: New source files.
* init.c (scm_boot_guile_1): Call scm_init_script.
* libguile.h: #include "script.h".
* Makefile.am (bin_PROGRAMS, guile_SOURCES, guile_LDADD): New
targets, for new executable.
(libguile_la_SOURCES): Mention script.c.
(modinclude_HEADERS): Add script.h.
* configure.in: Always check for -lm, -lsocket, -lnsl, whether or
not dynamic linking is enabled. This is because we're generating
executables now. Move CY_AC_WITH_THREADS call after those, so the
values of cy_cv_threads_libs captures the libs chosen above.
* Makefile.in, configure, aclocal.m4: Regenerated.
1997-04-19 13:25:21 +00:00
|
|
|
int
|
|
|
|
|
main (int argc, char **argv)
|
|
|
|
|
{
|
2011-11-22 12:11:48 +01:00
|
|
|
/* If we should install a locale, do it right at the beginning so that
|
|
|
|
|
string conversion for command-line arguments, along with possible
|
|
|
|
|
error messages, use the right locale. See
|
2011-11-22 12:11:48 +01:00
|
|
|
<https://lists.gnu.org/archive/html/guile-devel/2011-11/msg00041.html>
|
|
|
|
|
for the rationale. */
|
2011-11-22 12:11:48 +01:00
|
|
|
if (should_install_locale () && setlocale (LC_ALL, "") == NULL)
|
2011-11-22 12:11:48 +01:00
|
|
|
fprintf (stderr, "guile: warning: failed to install locale\n");
|
|
|
|
|
|
2011-12-02 11:22:46 +01:00
|
|
|
scm_install_gmp_memory_functions = 1;
|
Move most of the guts of shell command processing into libguile,
so guile.c can be very small (and eventuallly auto-generated. (I
mean, generated mechanically, not self-generated. Hmm.))
* guile.c, script.c, script.h: New source files.
* init.c (scm_boot_guile_1): Call scm_init_script.
* libguile.h: #include "script.h".
* Makefile.am (bin_PROGRAMS, guile_SOURCES, guile_LDADD): New
targets, for new executable.
(libguile_la_SOURCES): Mention script.c.
(modinclude_HEADERS): Add script.h.
* configure.in: Always check for -lm, -lsocket, -lnsl, whether or
not dynamic linking is enabled. This is because we're generating
executables now. Move CY_AC_WITH_THREADS call after those, so the
values of cy_cv_threads_libs captures the libs chosen above.
* Makefile.in, configure, aclocal.m4: Regenerated.
1997-04-19 13:25:21 +00:00
|
|
|
scm_boot_guile (argc, argv, inner_main, 0);
|
|
|
|
|
return 0; /* never reached */
|
|
|
|
|
}
|
2000-03-19 19:01:16 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Local Variables:
|
|
|
|
|
c-file-style: "gnu"
|
|
|
|
|
End:
|
|
|
|
|
*/
|