From 4247120b4aae19171519892d92f040666db1fc99 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 13 Nov 2016 15:32:43 +0300 Subject: [PATCH] (tty_init): support curses other than ncurses. Signed-off-by: Andrew Borodin --- lib/tty/tty-ncurses.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c index c6217526d..9b01ce6fa 100644 --- a/lib/tty/tty-ncurses.c +++ b/lib/tty/tty-ncurses.c @@ -194,11 +194,25 @@ tty_init (gboolean mouse_enable, gboolean is_xterm) ESCDELAY = 200; #endif /* HAVE_ESCDELAY */ +#ifdef NCURSES_VERSION /* use Ctrl-g to generate SIGINT */ cur_term->Nttyb.c_cc[VINTR] = CTRL ('g'); /* ^g */ /* disable SIGQUIT to allow use Ctrl-\ key */ cur_term->Nttyb.c_cc[VQUIT] = NULL_VALUE; tcsetattr (cur_term->Filedes, TCSANOW, &cur_term->Nttyb); +#else + /* other curses implementation (bsd curses, ...) */ + { + struct termios mode; + + tcgetattr (STDIN_FILENO, &mode); + /* use Ctrl-g to generate SIGINT */ + mode.c_cc[VINTR] = CTRL ('g'); /* ^g */ + /* disable SIGQUIT to allow use Ctrl-\ key */ + mode.c_cc[VQUIT] = NULL_VALUE; + tcsetattr (STDIN_FILENO, TCSANOW, &mode); + } +#endif /* NCURSES_VERSION */ tty_start_interrupt_key ();