tweaks: exclude some suspension code from the tiny version

The SIGCONT handler needs to stay, so that also in the tiny version
a 'fg' can properly resume from an external SIGTSTP.
master
Benno Schulenberg 2021-11-28 11:07:06 +01:00
parent 93df6ab385
commit d14d9069cd
2 changed files with 12 additions and 9 deletions

View File

@ -622,9 +622,9 @@ void shortcut_init(void)
#ifndef NANO_TINY
const char *wordcount_gist =
N_("Count the number of words, lines, and characters");
const char *suspend_gist = N_("Suspend the editor (return to the shell)");
#endif
const char *refresh_gist = N_("Refresh (redraw) the current screen");
const char *suspend_gist = N_("Suspend the editor (return to the shell)");
#ifdef ENABLE_WORDCOMPLETION
const char *completion_gist = N_("Try and complete the current word");
#endif
@ -983,14 +983,15 @@ void shortcut_init(void)
add_to_funcs(do_verbatim_input, MMAIN,
N_("Verbatim"), WITHORSANS(verbatim_gist), BLANKAFTER, NOVIEW);
#ifndef NANO_TINY
add_to_funcs(do_suspend, MMAIN,
N_("Suspend"), WITHORSANS(suspend_gist), TOGETHER, VIEW);
#endif
#ifdef ENABLE_HELP
add_to_funcs(full_refresh, MMAIN,
N_("Refresh"), WITHORSANS(refresh_gist), TOGETHER, VIEW);
N_("Refresh"), WITHORSANS(refresh_gist), BLANKAFTER, VIEW);
#endif
add_to_funcs(do_suspend, MMAIN,
N_("Suspend"), WITHORSANS(suspend_gist), BLANKAFTER, VIEW);
#ifndef NANO_TINY
add_to_funcs(do_indent, MMAIN,
N_("Indent"), WITHORSANS(indent_gist), TOGETHER, NOVIEW);

View File

@ -897,16 +897,16 @@ void signal_init(void)
/* Trap SIGWINCH because we want to handle window resizes. */
deed.sa_handler = handle_sigwinch;
sigaction(SIGWINCH, &deed, NULL);
#endif
/* In the suspend and continue handlers, block all other signals.
* If we don't do this, other stuff interrupts them! */
sigfillset(&deed.sa_mask);
#ifdef SIGTSTP
/* Prevent the suspend handler from getting interrupted. */
sigfillset(&deed.sa_mask);
deed.sa_handler = suspend_nano;
sigaction(SIGTSTP, &deed, NULL);
#endif
#endif /* !NANO_TINY */
#ifdef SIGCONT
sigfillset(&deed.sa_mask);
deed.sa_handler = continue_nano;
sigaction(SIGCONT, &deed, NULL);
#endif
@ -938,6 +938,7 @@ void handle_crash(int signal)
}
#endif
#ifndef NANO_TINY
/* Handler for SIGTSTP (suspend). */
void suspend_nano(int signal)
{
@ -971,6 +972,7 @@ void do_suspend(void)
ran_a_tool = TRUE;
}
#endif /* !NANO_TINY */
/* Handler for SIGCONT (continue after suspend). */
void continue_nano(int signal)