Merge branch '1404_ctrc_kills_mc'

* 1404_ctrc_kills_mc:
  Ticket #1404: Ctrl-C kills mc.
This commit is contained in:
Andrew Borodin 2009-08-04 15:30:03 +04:00
commit bd8f0f2c0b
3 changed files with 17 additions and 1 deletions

View File

@ -2306,6 +2306,9 @@ main (int argc, char *argv[])
#ifdef HAVE_SLANG
slang_init ();
#endif
start_interrupt_key ();
/* 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 */
init_key_input_fd ();

View File

@ -69,16 +69,27 @@ sigintr_handler(int signo)
/*** 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
tty_enable_interrupt_key(void)
{
struct sigaction act;
got_interrupt = 0;
act.sa_handler = sigintr_handler;
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
sigaction (SIGINT, &act, NULL);
got_interrupt = 0;
}
extern void

View File

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