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 <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi 2023-03-21 12:35:10 +08:00 committed by Alan Carvalho de Assis
parent b3cfcee47d
commit 4079f6d613

View File

@ -182,10 +182,6 @@ static int set_termios(int fd, int nocrlf)
tio.c_oflag |= ONLCR; tio.c_oflag |= ONLCR;
} }
/* disable echo if it's enabled to avoid double input character */
tio.c_iflag &= ~ECHO;
ret = tcsetattr(fd, TCSANOW, &tio); ret = tcsetattr(fd, TCSANOW, &tio);
if (ret) if (ret)
{ {
@ -194,19 +190,15 @@ static int set_termios(int fd, int nocrlf)
goto errout; 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) if (fd_std_tty >= 0)
{ {
tio = g_tio_std; tio = g_tio_std;
if (nocrlf == 0)
{ tio.c_iflag = 0;
tio.c_oflag |= ONLCR; tio.c_oflag = 0;
} tio.c_lflag &= ~ECHO;
else
{
tio.c_oflag &= ~ONLCR;
}
ret = tcsetattr(fd_std_tty, TCSANOW, &tio); ret = tcsetattr(fd_std_tty, TCSANOW, &tio);
if (ret) if (ret)