commit ac899e5f80ca5751a4a49eb1fdfe9b564b92dac9
parent d173c15ce55266060f3cedbeafe89640055deb63
Author: Chris Allegretta <chrisa@asty.org>
Date: Sat, 30 Jun 2001 04:09:09 +0000
do_suspend() - Added _POSIX_VDISABLE macro to fully ignore suspend keystroke. Eliminates the possibility that nano can be suspended when it's not supposed to be
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@703 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -118,6 +118,10 @@ Cvs code -
- Don't try to play with the handler inside the handler. Just
raise a SIGSTOP. We also now write the "use "fg"" message to
stdout instead of stderr.
+ - Added _POSIX_VDISABLE macro to fully ignore suspend keystroke.
+ Eliminates the possibility that nano can be suspended when
+ it's not supposed to be. Many many many thanks to Jordi and
+ Tom Lear for helping out finding and fixing this bug!
do_cont()
- Now just does a refresh call instead of playing with the SIGTSTP
handler.
diff --git a/nano.c b/nano.c
@@ -1740,6 +1740,9 @@ void handle_sigwinch(int s)
void signal_init(void)
{
+#ifdef _POSIX_VDISABLE
+ struct termios term;
+#endif
/* Trap SIGINT and SIGQUIT cuz we want them to do useful things. */
memset(&act, 0, sizeof(struct sigaction));
@@ -1754,7 +1757,17 @@ void signal_init(void)
sigaction(SIGWINCH, &act, NULL);
if (!ISSET(SUSPEND)) {
+
+/* Insane! */
+#ifdef _POSIX_VDISABLE
+ tcgetattr(0, &term);
+ term.c_cc[VSUSP] = _POSIX_VDISABLE;
+ tcsetattr(0, TCSANOW, &term);
+#else
+ act.sa_handler = SIG_IGN;
sigaction(SIGTSTP, &act, NULL);
+#endif
+
} else {
/* if we don't do this, it seems other stuff interrupts the
suspend handler! Try using nano with mutt without this line */