nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 4781d4d351bcea44065856cbb5fbf102d6a984f3
parent ef1a3b08ae08fac44643188da42e4e0009e21f22
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Wed, 24 May 2017 10:20:23 +0200

tweaks: reshuffle some stuff, to put related things closer together

Diffstat:
Msrc/nano.c | 22++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/nano.c b/src/nano.c @@ -1196,26 +1196,24 @@ void signal_init(void) sigaction(SIGWINCH, &act, NULL); #endif - /* Trap normal suspend (^Z) so we can handle it ourselves. */ - if (!ISSET(SUSPEND)) { - act.sa_handler = SIG_IGN; -#ifdef SIGTSTP - sigaction(SIGTSTP, &act, NULL); -#endif - } else { + /* Trap a normal suspend (^Z) so we can handle it ourselves. */ + if (ISSET(SUSPEND)) { /* Block all other signals in the suspend and continue handlers. * If we don't do this, other stuff interrupts them! */ sigfillset(&act.sa_mask); - - act.sa_handler = do_suspend; #ifdef SIGTSTP + act.sa_handler = do_suspend; sigaction(SIGTSTP, &act, NULL); #endif - - act.sa_handler = do_continue; #ifdef SIGCONT + act.sa_handler = do_continue; sigaction(SIGCONT, &act, NULL); #endif + } else { +#ifdef SIGTSTP + act.sa_handler = SIG_IGN; + sigaction(SIGTSTP, &act, NULL); +#endif } } @@ -1243,8 +1241,8 @@ RETSIGTYPE do_suspend(int signal) /* Restore the old terminal settings. */ tcsetattr(0, TCSANOW, &oldterm); - /* Do what mutt does: send ourselves a SIGSTOP. */ #ifdef SIGSTOP + /* Do what mutt does: send ourselves a SIGSTOP. */ kill(0, SIGSTOP); #endif }