1 // See LICENSE for license details.
3 // termios-xspike sets up a canonical terminal and blocks forever.
4 // It allows us to send Ctrl-C etc. to the target machine.
15 struct termios old_tios
;
16 if (tcgetattr(0, &old_tios
) < 0)
19 signal(SIGTERM
, [](int) { });
21 struct termios new_tios
= old_tios
;
22 new_tios
.c_lflag
&= ~(ICANON
| ECHO
| ISIG
);
23 if (tcsetattr(0, TCSANOW
, &new_tios
) < 0)
28 return tcsetattr(0, TCSANOW
, &old_tios
);