/* * Update the values of the erase, interrupt, and kill characters in 'mode'. * * SVr4 tset (e.g., Solaris 2.5) only modifies the intr, quit or erase * characters if they're unset, or if we specify them as options. This differs * from BSD 4.4 tset, which always sets erase. */ static void set_control_chars(void) { #ifdef TERMIOS if (DISABLED(mode.c_cc[VERASE]) || terasechar >= 0) mode.c_cc[VERASE] = (terasechar >= 0) ? terasechar : default_erase(); if (DISABLED(mode.c_cc[VINTR]) || intrchar >= 0) mode.c_cc[VINTR] = (intrchar >= 0) ? intrchar : CINTR; if (DISABLED(mode.c_cc[VKILL]) || tkillchar >= 0) mode.c_cc[VKILL] = (tkillchar >= 0) ? tkillchar : CKILL; #endif }
/* * Update the values of the erase, interrupt, and kill characters in the TTY * parameter. * * SVr4 tset (e.g., Solaris 2.5) only modifies the intr, quit or erase * characters if they're unset, or if we specify them as options. This differs * from BSD 4.4 tset, which always sets erase. */ void set_control_chars(TTY * tty_settings, int my_erase, int my_intr, int my_kill) { if (DISABLED(tty_settings->c_cc[VERASE]) || my_erase >= 0) { tty_settings->c_cc[VERASE] = UChar((my_erase >= 0) ? my_erase : default_erase()); } if (DISABLED(tty_settings->c_cc[VINTR]) || my_intr >= 0) { tty_settings->c_cc[VINTR] = UChar((my_intr >= 0) ? my_intr : CINTR); } if (DISABLED(tty_settings->c_cc[VKILL]) || my_kill >= 0) { tty_settings->c_cc[VKILL] = UChar((my_kill >= 0) ? my_kill : CKILL); } }