From 4079f6d613c4abbad3f828ed056961569ded800f Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Tue, 21 Mar 2023 12:35:10 +0800 Subject: [PATCH] system/cu: Let remote machine handle special character except Ctrl-C Let remote machine handle special character except Ctrl-C, make cu's behavior more close to linux/bsd system. Signed-off-by: Huang Qi --- system/cu/cu_main.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/system/cu/cu_main.c b/system/cu/cu_main.c index 29dfc243e..2015cf2ea 100644 --- a/system/cu/cu_main.c +++ b/system/cu/cu_main.c @@ -182,10 +182,6 @@ static int set_termios(int fd, int nocrlf) tio.c_oflag |= ONLCR; } - /* disable echo if it's enabled to avoid double input character */ - - tio.c_iflag &= ~ECHO; - ret = tcsetattr(fd, TCSANOW, &tio); if (ret) { @@ -194,19 +190,15 @@ static int set_termios(int fd, int nocrlf) goto errout; } - /* for tty stdout force enable or disable \n -> \r\n conversion */ + /* Let the remote machine to handle all crlf/echo except Ctrl-C */ if (fd_std_tty >= 0) { tio = g_tio_std; - if (nocrlf == 0) - { - tio.c_oflag |= ONLCR; - } - else - { - tio.c_oflag &= ~ONLCR; - } + + tio.c_iflag = 0; + tio.c_oflag = 0; + tio.c_lflag &= ~ECHO; ret = tcsetattr(fd_std_tty, TCSANOW, &tio); if (ret)