summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-03-31 20:36:47 +0200
committerBardur Arantsson <bardur@scientician.net>2012-03-31 20:45:24 +0200
commit2af4f72a86d70703bbb55515cb468fba6240fda7 (patch)
tree800f5f770c9013171c840c7f6d1dab5e9b51bafe
parenta6e2cf9cedf0b89991e776dad1db6871fc4c0d1f (diff)
Unix signals: Remove handle_signal_abort and handle_signal_simple
In short: Don't interfere with debugging and don't kill the player if their ssh connection is interrupted.
-rw-r--r--src/files.c190
1 files changed, 0 insertions, 190 deletions
diff --git a/src/files.c b/src/files.c
index ea331a15..56e57975 100644
--- a/src/files.c
+++ b/src/files.c
@@ -5991,130 +5991,6 @@ static void handle_signal_suspend(int sig)
/*
- * Handle signals -- simple (interrupt and quit)
- *
- * This function was causing a *huge* number of problems, so it has
- * been simplified greatly. We keep a global variable which counts
- * the number of times the user attempts to kill the process, and
- * we commit suicide if the user does this a certain number of times.
- *
- * We attempt to give "feedback" to the user as he approaches the
- * suicide thresh-hold, but without penalizing accidental keypresses.
- *
- * To prevent messy accidents, we should reset this global variable
- * whenever the user enters a keypress, or something like that.
- */
-static void handle_signal_simple(int sig)
-{
- /* Disable handler */
- (void)signal(sig, SIG_IGN);
-
-
- /* Nothing to save, just quit */
- if (!character_generated || character_saved) quit(NULL);
-
-
- /* Count the signals */
- signal_count++;
-
-
- /* Terminate dead characters */
- if (death)
- {
- /* Mark the savefile */
- (void)strcpy(died_from, "Abortion");
-
- /* Close stuff */
- close_game();
-
- /* Quit */
- quit("interrupt");
- }
-
- /* Allow suicide (after 5) */
- else if (signal_count >= 5)
- {
- /* Cause of "death" */
- (void)strcpy(died_from, "Interrupting");
-
- /* Stop playing */
- alive = FALSE;
-
- /* Suicide */
- death = TRUE;
-
- /* Leaving */
- p_ptr->leaving = TRUE;
-
- /* Close stuff */
- close_game();
-
- /* Quit */
- quit("interrupt");
- }
-
- /* Give warning (after 4) */
- else if (signal_count >= 4)
- {
- /* Make a noise */
- Term_xtra(TERM_XTRA_NOISE, 0);
-
- /* Clear the top line */
- Term_erase(0, 0, 255);
-
- /* Display the cause */
- Term_putstr(0, 0, -1, TERM_WHITE, "Contemplating suicide!");
-
- /* Flush */
- Term_fresh();
- }
-
- /* Give warning (after 2) */
- else if (signal_count >= 2)
- {
- /* Make a noise */
- Term_xtra(TERM_XTRA_NOISE, 0);
- }
-
- /* Restore handler */
- (void)signal(sig, handle_signal_simple);
-}
-
-
-/*
- * Handle signal -- abort, kill, etc
- */
-static void handle_signal_abort(int sig)
-{
- /* Disable handler */
- (void)signal(sig, SIG_IGN);
-
-
- /* Nothing to save, just quit */
- if (!character_generated || character_saved) quit(NULL);
-
-
- /* Clear the bottom line */
- Term_erase(0, 23, 255);
-
- /* Give a warning */
- Term_putstr(0, 23, -1, TERM_RED,
- "A gruesome software bug LEAPS out at you!");
-
- /* Message */
- Term_putstr(45, 23, -1, TERM_RED, "Panic save...");
-
- /* Flush output */
- Term_fresh();
-
- /* Quit */
- quit(format("software bug %d %d", p_ptr->px, p_ptr->py));
-}
-
-
-
-
-/*
* Ignore SIGTSTP signals (keyboard suspend)
*/
void signals_ignore_tstp(void)
@@ -6154,72 +6030,6 @@ void signals_init(void)
(void)signal(SIGTSTP, handle_signal_suspend);
#endif
-
-#ifdef SIGINT
- (void)signal(SIGINT, handle_signal_simple);
-#endif
-
-#ifdef SIGQUIT
- (void)signal(SIGQUIT, handle_signal_simple);
-#endif
-
-
-#ifdef SIGFPE
- (void)signal(SIGFPE, handle_signal_abort);
-#endif
-
-#ifdef SIGILL
- (void)signal(SIGILL, handle_signal_abort);
-#endif
-
-#ifdef SIGTRAP
- (void)signal(SIGTRAP, handle_signal_abort);
-#endif
-
-#ifdef SIGIOT
- (void)signal(SIGIOT, handle_signal_abort);
-#endif
-
-#ifdef SIGKILL
- (void)signal(SIGKILL, handle_signal_abort);
-#endif
-
-#ifdef SIGBUS
- (void)signal(SIGBUS, handle_signal_abort);
-#endif
-
-#ifdef SIGSEGV
- (void)signal(SIGSEGV, handle_signal_abort);
-#endif
-
-#ifdef SIGTERM
- (void)signal(SIGTERM, handle_signal_abort);
-#endif
-
-#ifdef SIGPIPE
- (void)signal(SIGPIPE, handle_signal_abort);
-#endif
-
-#ifdef SIGEMT
- (void)signal(SIGEMT, handle_signal_abort);
-#endif
-
-#ifdef SIGDANGER
- (void)signal(SIGDANGER, handle_signal_abort);
-#endif
-
-#ifdef SIGSYS
- (void)signal(SIGSYS, handle_signal_abort);
-#endif
-
-#ifdef SIGXCPU
- (void)signal(SIGXCPU, handle_signal_abort);
-#endif
-
-#ifdef SIGPWR
- (void)signal(SIGPWR, handle_signal_abort);
-#endif
-
}