+1999-09-23 Tom Tromey <tromey@cygnus.com>
+
+ * prims.cc (main_init): New function.
+ (JvRunMain): Call it.
+ (_Jv_RunMain): Likewise.
+ Include <signal.h>.
+ (main_init): Ignore SIGPIPE. Fixes PR 51.
+
1999-09-22 Tom Tromey <tromey@cygnus.com>
* libgcj.spec.in: Use `jc1' spec, not `cc1' spec.
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
+#include <signal.h>
#pragma implementation "gcj/array.h"
// The primary thread.
static java::lang::Thread *main_thread;
-void
-JvRunMain (jclass klass, int argc, const char **argv)
+static void
+main_init (void)
{
INIT_SEGV;
#ifdef HANDLE_FPE
LTDL_SET_PRELOADED_SYMBOLS ();
#endif
+ // FIXME: we only want this on POSIX systems.
+ struct sigaction act;
+ act.sa_handler = SIG_IGN;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction (SIGPIPE, &act, NULL);
+}
+
+void
+JvRunMain (jclass klass, int argc, const char **argv)
+{
+ main_init ();
+
arg_vec = JvConvertArgv (argc - 1, argv + 1);
main_group = new java::lang::ThreadGroup (23);
main_thread = new java::lang::FirstThread (main_group, klass, arg_vec);
void
_Jv_RunMain (const char *class_name, int argc, const char **argv)
{
- INIT_SEGV;
-#ifdef HANDLE_FPE
- INIT_FPE;
-#else
- arithexception = new java::lang::ArithmeticException
- (JvNewStringLatin1 ("/ by zero"));
-#endif
-
- no_memory = new java::lang::OutOfMemoryError;
-
-#ifdef USE_LTDL
- LTDL_SET_PRELOADED_SYMBOLS ();
-#endif
+ main_init ();
arg_vec = JvConvertArgv (argc - 1, argv + 1);
main_group = new java::lang::ThreadGroup (23);