Commit aded56de authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

blc_set_back_stdin_mode has no effect if stdin state has never been saved

parent 7004b5af
......@@ -34,8 +34,7 @@ uchar blc_bar_colors[BLC_BAR_COLORS_NB] = { BLC_BLUE, BLC_BRIGHT_BLUE, BLC_CYAN,
int blc_stdout_ansi = 1;
int blc_stderr_ansi = 1;
static struct termios blc_initial_tty_mode;
static struct termios blc_initial_tty_mode={0};
void signal_callback(int signal_id)
......@@ -304,7 +303,15 @@ void blc_set_stdin_non_blocking_mode(){
}
void blc_set_back_stdin_mode(){
tcsetattr(STDIN_FILENO, TCSANOW, &blc_initial_tty_mode);
int i;
//Complex but just check if blc_initial_tty_mode as been initialized
FOR_INV(i, sizeof(blc_initial_tty_mode)) if (((char*)&blc_initial_tty_mode)[i]!=0) break;
// i==-1 means all the butes was 0
if (i!=-1) SYSTEM_ERROR_CHECK(tcsetattr(STDIN_FILENO, TCSANOW, &blc_initial_tty_mode), -1, NULL);
}
END_EXTERN_C
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment