Ticket #1404: Ctrl-C kills mc.

If MC built with --without-subshell option is run with -d option,
the Ctrl-C key combination closes MC. Such behaviour was introduced
in 66332a4fb1 commit.

This commit actually restores the SIGINT signal handling which was
before 66332a4fb1 commit.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2009-07-15 22:31:52 +04:00
parent ff31f67d6b
commit c6812961cc
3 changed files with 17 additions and 1 deletions

View File

@ -2306,6 +2306,9 @@ main (int argc, char *argv[])
#ifdef HAVE_SLANG #ifdef HAVE_SLANG
slang_init (); slang_init ();
#endif #endif
start_interrupt_key ();
/* NOTE: This call has to be after slang_init. It's the small part from /* NOTE: This call has to be after slang_init. It's the small part from
the previous init_key which had to be moved after the call of slang_init */ the previous init_key which had to be moved after the call of slang_init */
init_key_input_fd (); init_key_input_fd ();

View File

@ -69,16 +69,27 @@ sigintr_handler(int signo)
/*** public functions **************************************************/ /*** public functions **************************************************/
extern void
tty_start_interrupt_key(void)
{
struct sigaction act;
act.sa_handler = sigintr_handler;
sigemptyset (&act.sa_mask);
act.sa_flags = SA_RESTART;
sigaction (SIGINT, &act, NULL);
}
extern void extern void
tty_enable_interrupt_key(void) tty_enable_interrupt_key(void)
{ {
struct sigaction act; struct sigaction act;
got_interrupt = 0;
act.sa_handler = sigintr_handler; act.sa_handler = sigintr_handler;
sigemptyset (&act.sa_mask); sigemptyset (&act.sa_mask);
act.sa_flags = 0; act.sa_flags = 0;
sigaction (SIGINT, &act, NULL); sigaction (SIGINT, &act, NULL);
got_interrupt = 0;
} }
extern void extern void

View File

@ -40,6 +40,7 @@
/* {{{ Input }}} */ /* {{{ Input }}} */
extern void tty_start_interrupt_key(void);
extern void tty_enable_interrupt_key(void); extern void tty_enable_interrupt_key(void);
extern void tty_disable_interrupt_key(void); extern void tty_disable_interrupt_key(void);
extern gboolean tty_got_interrupt(void); extern gboolean tty_got_interrupt(void);
@ -70,6 +71,7 @@ extern char *tty_tgetstr (const char *name);
/* legacy interface */ /* legacy interface */
#define start_interrupt_key() tty_start_interrupt_key()
#define enable_interrupt_key() tty_enable_interrupt_key() #define enable_interrupt_key() tty_enable_interrupt_key()
#define disable_interrupt_key() tty_disable_interrupt_key() #define disable_interrupt_key() tty_disable_interrupt_key()
#define got_interrupt() tty_got_interrupt() #define got_interrupt() tty_got_interrupt()