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

master
Benno Schulenberg 2017-05-24 10:20:23 +02:00
parent ef1a3b08ae
commit 4781d4d351
1 changed files with 10 additions and 12 deletions

View File

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