X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-sys%2Fmutt_signal.c;h=bdb857752d505a7995f970a77ecf3d697ae1104d;hp=25cfe6e27b9be8c5ab9d8435e043d45b1d6a6857;hb=8b89861e79d1b2e8ddcc54ea4d89957d6d10ebe6;hpb=f65ae399906906f734398432691dbacf2c7bda9f diff --git a/lib-sys/mutt_signal.c b/lib-sys/mutt_signal.c index 25cfe6e..bdb8577 100644 --- a/lib-sys/mutt_signal.c +++ b/lib-sys/mutt_signal.c @@ -9,7 +9,7 @@ #include -#include +#include #include "mutt_signal.h" @@ -20,32 +20,20 @@ static struct sigaction SysOldQuit; static int IsEndwin = 0; /* Attempt to catch "ordinary" signals and shut down gracefully. */ -static RETSIGTYPE exit_handler (int sig) +static void exit_handler (int sig) { - curs_set (1); - endwin (); /* just to be safe */ -#ifdef SYS_SIGLIST_DECLARED - printf (_("%s... Exiting.\n"), sys_siglist[sig]); -#else -#if defined(__sun__) && defined(__svr4__) - printf (_("Caught %s... Exiting.\n"), _sys_siglist[sig]); -#else -#if defined(__alpha) && defined(__osf__) - printf (_("Caught %s... Exiting.\n"), __sys_siglist[sig]); -#else - printf (_("Caught signal %d... Exiting.\n"), sig); -#endif -#endif -#endif - exit (0); + curs_set(1); + endwin(); /* just to be safe */ + printf(_("Caught %s... Exiting.\n"), strsignal(sig)); + exit(0); } -static RETSIGTYPE chld_handler(int sig __attribute__((unused))) +static void chld_handler(int sig __attribute__((unused))) { /* empty */ } -static RETSIGTYPE sighandler (int sig) +static void sighandler (int sig) { int save_errno = errno; @@ -61,36 +49,21 @@ static RETSIGTYPE sighandler (int sig) case SIGCONT: if (!IsEndwin) - refresh (); + refresh(); mutt_curs_set (-1); -#if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM) /* We don't receive SIGWINCH when suspended; however, no harm is done by * just assuming we received one, and triggering the 'resize' anyway. */ - SigWinch = 1; -#endif - break; - -#if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM) case SIGWINCH: SigWinch = 1; break; -#endif case SIGINT: SigInt = 1; break; - } errno = save_errno; } -#ifdef USE_SLANG_CURSES -int mutt_intr_hook (void) -{ - return (-1); -} -#endif /* USE_SLANG_CURSES */ - void mutt_signal_initialize (void) { struct sigaction act; @@ -124,9 +97,7 @@ void mutt_signal_initialize (void) sigaction (SIGCONT, &act, NULL); sigaction (SIGTSTP, &act, NULL); sigaction (SIGINT, &act, NULL); -#if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM) sigaction (SIGWINCH, &act, NULL); -#endif /* POSIX doesn't allow us to ignore SIGCHLD, * so we just install a dummy handler for it @@ -137,17 +108,6 @@ void mutt_signal_initialize (void) /* we don't want to mess with stopped children */ act.sa_flags |= SA_NOCLDSTOP; sigaction (SIGCHLD, &act, NULL); - -#ifdef USE_SLANG_CURSES - /* This bit of code is required because of the implementation of - * SLcurses_wgetch(). If a signal is received (like SIGWINCH) when we - * are in blocking mode, SLsys_getkey() will not return an error unless - * a handler function is defined and it returns -1. This is needed so - * that if the user resizes the screen while at a prompt, it will just - * abort and go back to the main-menu. - */ - SLang_getkey_intr_hook = mutt_intr_hook; -#endif } /* signals which are important to block while doing critical ops */ @@ -159,9 +119,7 @@ void mutt_block_signals (void) sigaddset (&Sigset, SIGHUP); sigaddset (&Sigset, SIGTSTP); sigaddset (&Sigset, SIGINT); -#if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM) sigaddset (&Sigset, SIGWINCH); -#endif sigprocmask (SIG_BLOCK, &Sigset, 0); set_option (OPTSIGNALSBLOCKED); }