static void sig_sigtstp (int sig) /*{{{*/ { (void) sig; SLsig_block_signals (); reset_tty (); kill(getpid(),SIGSTOP); init_tty (); if (Use_SLang_Readline == 0) { #ifdef HAVE_GNU_READLINE rl_refresh_line (0,0); #endif } else { if (Active_Rline_Info != NULL) { SLrline_set_display_width (Active_Rline_Info, SLtt_Screen_Cols); SLrline_redraw (Active_Rline_Info); } } SLsig_unblock_signals (); }
static int screen_size_changed_hook (VOID_STAR cd_unused) { (void) cd_unused; if (Want_Window_Size_Change) { Want_Window_Size_Change = 0; if (Active_Rline_Info != NULL) { SLtt_get_screen_size (); SLrline_set_display_width (Active_Rline_Info, SLtt_Screen_Cols); } } return 0; }
static void sig_sigtstp (int sig) { (void) sig; SLsig_block_signals (); reset_tty (); kill(getpid(),SIGSTOP); init_tty (); if (Active_Rline_Info != NULL) { SLrline_set_display_width (Active_Rline_Info, SLtt_Screen_Cols); SLrline_redraw (Active_Rline_Info); } SLsig_unblock_signals (); }
static void suspend_slsh (void) { reset_tty (); (void) SLang_run_hooks ("slsh_readline_suspend_before_hook", 0); kill (0, SIGSTOP); (void) SLang_run_hooks ("slsh_readline_suspend_after_hook", 0); init_tty (); if (Active_Rline_Info != NULL) { SLsig_block_signals (); SLrline_set_display_width (Active_Rline_Info->rli, SLtt_Screen_Cols); SLrline_redraw (Active_Rline_Info->rli); SLsig_unblock_signals (); } }
static char *read_input_line (Slsh_Readline_Type *sri, char *prompt, int noecho) { char *line; if (Use_Readline == 0) return read_with_no_readline (prompt, noecho); #if SYSTEM_SUPPORTS_SIGNALS init_tty (); #endif #if USE_GNU_READLINE (void) sri; if (noecho == 0) rl_redisplay_function = rl_redisplay; else { /* FIXME: What is the proper way to implement this in GNU readline? */ (void) fputs (prompt, stdout); (void) fflush (stdout); rl_redisplay_function = redisplay_dummy; } line = readline (prompt); rl_redisplay_function = rl_redisplay; #else SLtt_get_screen_size (); SLrline_set_display_width (sri->rli, SLtt_Screen_Cols); (void) add_sigwinch_handlers (); Active_Rline_Info = sri; (void) SLrline_set_echo (sri->rli, (noecho == 0)); line = SLrline_read_line (sri->rli, prompt, NULL); Active_Rline_Info = NULL; #endif #if SYSTEM_SUPPORTS_SIGNALS reset_tty (); #endif if (sri->output_newline) fputs ("\r\n", stdout); fflush (stdout); return line; }
static char *read_input_line (SLang_RLine_Info_Type *rline, char *prompt, int noecho) { char *line; #ifdef REAL_UNIX_SYSTEM int stdin_is_noecho = 0; #endif if (Use_Readline == 0) { char buf[1024]; char *b; fprintf (stdout, "%s", prompt); fflush (stdout); if (noecho) { #ifdef REAL_UNIX_SYSTEM if (isatty (fileno(stdin))) { (void) SLsystem ("stty -echo"); /* yuk */ stdin_is_noecho = 1; } #endif } line = buf; while (NULL == fgets (buf, sizeof (buf), stdin)) { #ifdef EINTR if (errno == EINTR) { if (-1 == SLang_handle_interrupt ()) { line = NULL; break; } continue; } #endif line = NULL; break; } #ifdef REAL_UNIX_SYSTEM if (stdin_is_noecho) (void) SLsystem ("stty echo"); #endif if (line == NULL) return NULL; /* Remove the final newline */ b = line; while (*b && (*b != '\n')) b++; *b = 0; return SLmake_string (line); } #if SYSTEM_SUPPORTS_SIGNALS init_tty (); #endif #if USE_GNU_READLINE (void) rline; if (noecho == 0) rl_redisplay_function = rl_redisplay; else { /* FIXME: What is the proper way to implement this in GNU readline? */ (void) fputs (prompt, stdout); (void) fflush (stdout); rl_redisplay_function = redisplay_dummy; } line = readline (prompt); rl_redisplay_function = rl_redisplay; #else SLtt_get_screen_size (); SLrline_set_display_width (rline, SLtt_Screen_Cols); (void) add_sigwinch_handlers (); Active_Rline_Info = rline; (void) SLrline_set_echo (rline, (noecho == 0)); line = SLrline_read_line (rline, prompt, NULL); Active_Rline_Info = NULL; #endif #if SYSTEM_SUPPORTS_SIGNALS reset_tty (); #else fputs ("\r\n", stdout); fflush (stdout); #endif return line; }