aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorKaroly Lorentey2003-12-29 07:24:41 +0000
committerKaroly Lorentey2003-12-29 07:24:41 +0000
commit9f729af551e991e5f6d49f329674f6802450d70f (patch)
treeca7c316daebbe6cebc208475d6c5c2e89a7f30fe /lib-src
parent0a1258976b3ac8f6ffc56115def6bd2e5b76f8bc (diff)
downloademacs-9f729af551e991e5f6d49f329674f6802450d70f.tar.gz
emacs-9f729af551e991e5f6d49f329674f6802450d70f.zip
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
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsclient.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 51f94877af1..174923e2dc8 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -381,6 +381,7 @@ struct termios tty;
381int old_tty_valid; 381int old_tty_valid;
382 382
383int tty_erase_char; 383int tty_erase_char;
384int quit_char = 'g' & 037;
384int flow_control = 0; 385int flow_control = 0;
385int meta_key = 0; 386int meta_key = 0;
386char _sobuf[BUFSIZ]; 387char _sobuf[BUFSIZ];
@@ -435,8 +436,11 @@ init_tty ()
435 tty.c_cflag &= ~PARENB; /* Don't check parity */ 436 tty.c_cflag &= ~PARENB; /* Don't check parity */
436 } 437 }
437#endif 438#endif
438 tty.c_cc[VINTR] = CDISABLE; 439 tty.c_cc[VINTR] = quit_char; /* C-g (usually) gives SIGINT */
439 tty.c_cc[VQUIT] = CDISABLE; 440 /* Set up C-g for both SIGQUIT and SIGINT.
441 We don't know which we will get, but we handle both alike
442 so which one it really gives us does not matter. */
443 tty.c_cc[VQUIT] = quit_char;
440 tty.c_cc[VMIN] = 1; /* Input should wait for at least 1 char */ 444 tty.c_cc[VMIN] = 1; /* Input should wait for at least 1 char */
441 tty.c_cc[VTIME] = 0; /* no matter how long that takes. */ 445 tty.c_cc[VTIME] = 0; /* no matter how long that takes. */
442#ifdef VSWTCH 446#ifdef VSWTCH
@@ -642,13 +646,25 @@ window_change_signal (int signalnum)
642 errno = old_errno; 646 errno = old_errno;
643} 647}
644 648
649SIGTYPE
650interrupt_signal (int signalnum)
651{
652 int old_errno = errno;
653
654 /* Forward it to Emacs. */
655 if (emacs_pid)
656 kill (emacs_pid, SIGINT);
657
658 errno = old_errno;
659}
660
645int 661int
646init_signals () 662init_signals ()
647{ 663{
648 /* Set up signal handlers. */ 664 /* Set up signal handlers. */
649 signal (SIGWINCH, window_change_signal); 665 signal (SIGWINCH, window_change_signal);
650 signal (SIGHUP, hang_up_signal); 666 signal (SIGHUP, hang_up_signal);
651 667 signal (SIGINT, interrupt_signal);
652 return 1; 668 return 1;
653} 669}
654 670