static int open_interactive (void) { if (Use_Readline && (-1 == open_readline ("slsh"))) return -1; if (NULL == (Readline_Load_Object = SLallocate_load_type ("<stdin>"))) { if (Use_Readline) close_readline (); return -1; } Readline_Load_Object->read = read_using_readline; Readline_Load_Object->auto_declare_globals = 1; #if !SYSTEM_SUPPORTS_SIGNALS /* If the system does not support asynchronouse signals, then it may install * a SLang_Interrupt hook that checks for ^C, etc. For that reason, the * tty must be initialized the whole time. */ init_tty (); #endif enable_keyboard_interrupt (); return 0; }
static int open_readline (SLFUTURE_CONST char *name) { unsigned int flags = SL_RLINE_BLINK_MATCH|SL_RLINE_USE_MULTILINE; close_readline (); Default_Readline_Info = open_slsh_readline (name, flags); if (Default_Readline_Info == NULL) return -1; return 0; }
static int open_readline (char *name) { #if USE_GNU_READLINE return 0; #else unsigned int flags = SL_RLINE_BLINK_MATCH|SL_RLINE_USE_MULTILINE; close_readline (); if (NULL == (Rline_Info = SLrline_open2 (name, SLtt_Screen_Cols, flags))) return -1; return 0; #endif }
static void close_interactive (void) { close_readline (); if (Readline_Load_Object == NULL) return; SLdeallocate_load_type (Readline_Load_Object); Readline_Load_Object = NULL; #if !SYSTEM_SUPPORTS_SIGNALS reset_tty (); #endif }