{
tcgetattr(0, &term_orig);
term_vi = term_orig;
- term_vi.c_lflag &= (~ICANON & ~ECHO); // leave ISIG ON- allow intr's
+ term_vi.c_lflag &= (~ICANON & ~ECHO); // leave ISIG on - allow intr's
term_vi.c_iflag &= (~IXON & ~ICRNL);
term_vi.c_oflag &= (~ONLCR);
term_vi.c_cc[VMIN] = 1;
/* non-raw output; add CR to each NL */
G.tty_attrs.c_oflag = OPOST | ONLCR;
- G.tty_attrs.c_cc[VMIN] = 1; /* block reads if < 1 char is available */
- G.tty_attrs.c_cc[VTIME] = 0; /* no timeout (reads block forever) */
+ /* reads would block only if < 1 char is available */
+ G.tty_attrs.c_cc[VMIN] = 1;
+ /* no timeout (reads block forever) */
+ G.tty_attrs.c_cc[VTIME] = 0;
#ifdef __linux__
G.tty_attrs.c_line = 0;
#endif
cin_fileno = fileno(cin);
getTermSettings(cin_fileno, &initial_settings);
new_settings = initial_settings;
- new_settings.c_lflag &= ~ICANON;
- new_settings.c_lflag &= ~ECHO;
+ new_settings.c_lflag &= ~(ICANON | ECHO);
new_settings.c_cc[VMIN] = 1;
new_settings.c_cc[VTIME] = 0;
setTermSettings(cin_fileno, &new_settings);