# HG changeset patch # User Karoly Lorentey # Date 1072682681 0 # Node ID 201b17b0f2e54a4f8355b9ada75f069cef8fc015 # Parent d4e6a050c9b1447783682cf38a5d1227c3e327c3 Handle Ctl-G in emacsclient. lib-src/emacsclient.c (quit_char): New variable. (init_tty): Use it. (interrupt_signal): Forward SIGINT to Emacs. (init_signals): Install SIGINT handler. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-20 diff -r d4e6a050c9b1 -r 201b17b0f2e5 lib-src/emacsclient.c --- a/lib-src/emacsclient.c Mon Dec 29 07:16:26 2003 +0000 +++ b/lib-src/emacsclient.c Mon Dec 29 07:24:41 2003 +0000 @@ -381,6 +381,7 @@ int old_tty_valid; int tty_erase_char; +int quit_char = 'g' & 037; int flow_control = 0; int meta_key = 0; char _sobuf[BUFSIZ]; @@ -435,8 +436,11 @@ tty.c_cflag &= ~PARENB; /* Don't check parity */ } #endif - tty.c_cc[VINTR] = CDISABLE; - tty.c_cc[VQUIT] = CDISABLE; + tty.c_cc[VINTR] = quit_char; /* C-g (usually) gives SIGINT */ + /* Set up C-g for both SIGQUIT and SIGINT. + We don't know which we will get, but we handle both alike + so which one it really gives us does not matter. */ + tty.c_cc[VQUIT] = quit_char; tty.c_cc[VMIN] = 1; /* Input should wait for at least 1 char */ tty.c_cc[VTIME] = 0; /* no matter how long that takes. */ #ifdef VSWTCH @@ -642,13 +646,25 @@ errno = old_errno; } +SIGTYPE +interrupt_signal (int signalnum) +{ + int old_errno = errno; + + /* Forward it to Emacs. */ + if (emacs_pid) + kill (emacs_pid, SIGINT); + + errno = old_errno; +} + int init_signals () { /* Set up signal handlers. */ signal (SIGWINCH, window_change_signal); signal (SIGHUP, hang_up_signal); - + signal (SIGINT, interrupt_signal); return 1; }