diff src/SDL_fatal.c @ 1330:450721ad5436

It's now possible to build SDL without any C runtime at all on Windows, using Visual C++ 2005
author Sam Lantinga <slouken@libsdl.org>
date Mon, 06 Feb 2006 08:28:51 +0000
parents c9b51268668f
children d910939febfa
line wrap: on
line diff
--- a/src/SDL_fatal.c	Sat Feb 04 22:01:44 2006 +0000
+++ b/src/SDL_fatal.c	Mon Feb 06 08:28:51 2006 +0000
@@ -20,91 +20,27 @@
     slouken@libsdl.org
 */
 
-#ifdef _WIN32_WCE
-#define NO_SIGNAL_H
-#endif
- 
 /* General fatal signal handling code for SDL */
 
-#ifdef NO_SIGNAL_H
-
-/* No signals on this platform, nothing to do.. */
-
-void SDL_InstallParachute(void)
-{
-	return;
-}
+#include "SDL_config.h"
 
-void SDL_UninstallParachute(void)
-{
-	return;
-}
+#ifdef HAVE_SIGNAL_H
 
-#else
-
-#include <stdlib.h>
-#include <stdio.h>
 #include <signal.h>
-#include <string.h>
 
 #include "SDL.h"
 #include "SDL_fatal.h"
 
-#ifdef __CYGWIN__
-#define DISABLE_STDIO
-#endif
-
 /* This installs some signal handlers for the more common fatal signals,
    so that if the programmer is lazy, the app doesn't die so horribly if
    the program crashes.
 */
 
-static void print_msg(const char *text)
-{
-#ifndef DISABLE_STDIO
-	fprintf(stderr, "%s", text);
-#endif
-}
-
 static void SDL_Parachute(int sig)
 {
 	signal(sig, SIG_DFL);
-	print_msg("Fatal signal: ");
-	switch (sig) {
-		case SIGSEGV:
-			print_msg("Segmentation Fault");
-			break;
-#ifdef SIGBUS
-#if SIGBUS != SIGSEGV
-		case SIGBUS:
-			print_msg("Bus Error");
-			break;
-#endif
-#endif /* SIGBUS */
-#ifdef SIGFPE
-		case SIGFPE:
-			print_msg("Floating Point Exception");
-			break;
-#endif /* SIGFPE */
-#ifdef SIGQUIT
-		case SIGQUIT:
-			print_msg("Keyboard Quit");
-			break;
-#endif /* SIGQUIT */
-#ifdef SIGPIPE
-		case SIGPIPE:
-			print_msg("Broken Pipe");
-			break;
-#endif /* SIGPIPE */
-		default:
-#ifndef DISABLE_STDIO
-			fprintf(stderr, "# %d", sig);
-#endif
-			break;
-	}
-	print_msg(" (SDL Parachute Deployed)\n");
 	SDL_Quit();
-	exit(-sig);
+	raise(sig);
 }
 
 static int SDL_fatal_signals[] = {
@@ -182,4 +118,18 @@
 #endif /* HAVE_SIGACTION */
 }
 
-#endif /* NO_SIGNAL_H */
+#else
+
+/* No signals on this platform, nothing to do.. */
+
+void SDL_InstallParachute(void)
+{
+	return;
+}
+
+void SDL_UninstallParachute(void)
+{
+	return;
+}
+
+#endif /* HAVE_SIGNAL_H */