static void reset_info_window_sizes (void) { terminal_goto_xy (0, 0); fflush (stdout); terminal_unprep_terminal (); terminal_get_screen_size (); terminal_prep_terminal (); display_initialize_display (screenwidth, screenheight); window_new_screen_size (screenwidth, screenheight); redisplay_after_signal (); }
/* At the line START, delete COUNT lines from the terminal display. */ static void terminal_delete_lines (int start, int count) { int lines; /* Normalize arguments. */ if (start < 0) start = 0; lines = screenheight - start; terminal_goto_xy (0, start); if (term_DL) tputs (tgoto (term_DL, 0, count), lines, output_character_function); else { while (count--) tputs (term_dl, lines, output_character_function); } fflush (stdout); }
static RETSIGTYPE info_signal_proc (int sig) { signal_info *old_signal_handler = NULL; #if !defined (HAVE_SIGACTION) /* best effort: first increment this counter and later block signals */ if (term_conf_busy) return; term_conf_busy++; #if defined (HAVE_SIGPROCMASK) || defined (HAVE_SIGSETMASK) { sigset_t nvar, ovar; sigemptyset (&nvar); mask_termsig (&nvar); sigprocmask (SIG_BLOCK, &nvar, &ovar); } #endif /* HAVE_SIGPROCMASK || HAVE_SIGSETMASK */ #endif /* !HAVE_SIGACTION */ switch (sig) { #if defined (SIGTSTP) case SIGTSTP: case SIGTTOU: case SIGTTIN: #endif #if defined (SIGQUIT) case SIGQUIT: #endif #if defined (SIGINT) case SIGINT: #endif { #if defined (SIGTSTP) if (sig == SIGTSTP) old_signal_handler = &old_TSTP; if (sig == SIGTTOU) old_signal_handler = &old_TTOU; if (sig == SIGTTIN) old_signal_handler = &old_TTIN; #endif /* SIGTSTP */ #if defined (SIGQUIT) if (sig == SIGQUIT) old_signal_handler = &old_QUIT; #endif /* SIGQUIT */ #if defined (SIGINT) if (sig == SIGINT) old_signal_handler = &old_INT; #endif /* SIGINT */ /* For stop signals, restore the terminal IO, leave the cursor at the bottom of the window, and stop us. */ terminal_goto_xy (0, screenheight - 1); terminal_clear_to_eol (); fflush (stdout); terminal_unprep_terminal (); restore_termsig (sig, old_signal_handler); UNBLOCK_SIGNAL (sig); kill (getpid (), sig); /* The program is returning now. Restore our signal handler, turn on terminal handling, redraw the screen, and place the cursor where it belongs. */ terminal_prep_terminal (); set_termsig (sig, old_signal_handler); /* window size might be changed while sleeping */ reset_info_window_sizes (); } break; #if defined (SIGWINCH) || defined (SIGUSR1) #ifdef SIGWINCH case SIGWINCH: #endif #ifdef SIGUSR1 case SIGUSR1: #endif { /* Turn off terminal IO, tell our parent that the window has changed, then reinitialize the terminal and rebuild our windows. */ #ifdef SIGWINCH if (sig == SIGWINCH) old_signal_handler = &old_WINCH; #endif #ifdef SIGUSR1 if (sig == SIGUSR1) old_signal_handler = &old_USR1; #endif terminal_goto_xy (0, 0); fflush (stdout); terminal_unprep_terminal (); /* needless? */ restore_termsig (sig, old_signal_handler); UNBLOCK_SIGNAL (sig); kill (getpid (), sig); /* After our old signal handler returns... */ set_termsig (sig, old_signal_handler); /* needless? */ terminal_prep_terminal (); reset_info_window_sizes (); } break; #endif /* SIGWINCH || SIGUSR1 */ } #if !defined (HAVE_SIGACTION) /* at this time it is safer to perform unblock after decrement */ term_conf_busy--; #if defined (HAVE_SIGPROCMASK) || defined (HAVE_SIGSETMASK) { sigset_t nvar, ovar; sigemptyset (&nvar); mask_termsig (&nvar); sigprocmask (SIG_UNBLOCK, &nvar, &ovar); } #endif /* HAVE_SIGPROCMASK || HAVE_SIGSETMASK */ #endif /* !HAVE_SIGACTION */ }