diff --git a/src/main.c b/src/main.c index 126f04cab..72f3d7118 100644 --- a/src/main.c +++ b/src/main.c @@ -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 (); diff --git a/src/tty.c b/src/tty.c index ee50840a9..17edb8808 100644 --- a/src/tty.c +++ b/src/tty.c @@ -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 diff --git a/src/tty.h b/src/tty.h index b9b198d07..23ad980f5 100644 --- a/src/tty.h +++ b/src/tty.h @@ -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()