diff options
| author | Karoly Lorentey | 2003-12-29 07:24:41 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2003-12-29 07:24:41 +0000 |
| commit | 9f729af551e991e5f6d49f329674f6802450d70f (patch) | |
| tree | ca7c316daebbe6cebc208475d6c5c2e89a7f30fe /lib-src | |
| parent | 0a1258976b3ac8f6ffc56115def6bd2e5b76f8bc (diff) | |
| download | emacs-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.c | 22 |
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; | |||
| 381 | int old_tty_valid; | 381 | int old_tty_valid; |
| 382 | 382 | ||
| 383 | int tty_erase_char; | 383 | int tty_erase_char; |
| 384 | int quit_char = 'g' & 037; | ||
| 384 | int flow_control = 0; | 385 | int flow_control = 0; |
| 385 | int meta_key = 0; | 386 | int meta_key = 0; |
| 386 | char _sobuf[BUFSIZ]; | 387 | char _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 | ||
| 649 | SIGTYPE | ||
| 650 | interrupt_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 | |||
| 645 | int | 661 | int |
| 646 | init_signals () | 662 | init_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 | ||