Ticket #1926: Ctrl-\ key behaviour in NCurses-based MC.

Generally, Ctrl-\ is a default assignment to SIGQUIT signal.
S-Lang breaks this assignment. NCurses doesn't, therefore
MC just quits when user presses the Ctrl-\ key.

This commit emulates the S-Lang way in NCurses-based MC.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-02-06 13:07:35 +03:00
parent e23b0d5a95
commit 56bf77ae57
3 changed files with 15 additions and 12 deletions

View File

@ -8,6 +8,17 @@
#include "lib/global.h" /* include <glib.h> */
/* Taken from S-Lang's slutty.c */
#ifdef ultrix /* Ultrix gets _POSIX_VDISABLE wrong! */
# define NULL_VALUE -1
#else
# ifdef _POSIX_VDISABLE
# define NULL_VALUE _POSIX_VDISABLE
# else
# define NULL_VALUE 255
# endif
#endif
/* If true lines are shown by spaces */
extern gboolean slow_tty;

View File

@ -62,6 +62,7 @@
/*** global variables **************************************************/
/*** file scope macro definitions **************************************/
#if defined(_AIX) && !defined(CTRL)
# define CTRL(x) ((x) & 0x1f)
#endif
@ -158,6 +159,8 @@ tty_init (gboolean slow, gboolean ugly_lines)
/* 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);
tty_start_interrupt_key ();

View File

@ -52,21 +52,11 @@
/*** global variables **************************************************/
extern int reset_hp_softkeys;
/*** file scope macro definitions **************************************/
/* Taken from S-Lang's slutty.c */
#ifdef ultrix /* Ultrix gets _POSIX_VDISABLE wrong! */
# define NULL_VALUE -1
#else
# ifdef _POSIX_VDISABLE
# define NULL_VALUE _POSIX_VDISABLE
# else
# define NULL_VALUE 255
# endif
#endif /* ultrix */
#ifndef SA_RESTART
# define SA_RESTART 0
#endif
@ -79,7 +69,6 @@ extern int reset_hp_softkeys;
#define SLTT_MAX_SCREEN_ROWS 512
#endif
/*** file scope type declarations **************************************/
/*** file scope variables **********************************************/