Fix a bug when talking to non-freebsd machines where carriage return

was being interperated and displayed as ^M on the remote side.

Old curses used to change the behavior of the tty and how carriage
return was interperated via STDIN.  ncurses does this on a per-window
basis within the library rather than using the tty modes.  Since
talk is bypassing ncurses, it was missing the conversion.

Reviewed by:	peter
This commit is contained in:
Paul Saab 2000-07-11 01:31:39 +00:00
parent 18b8dc18fd
commit 11128de973
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=62932

View File

@ -103,10 +103,14 @@ talk()
* We can't make the tty non_blocking, because
* curses's output routines would screw up
*/
int i;
ioctl(0, FIONREAD, (struct sgttyb *) &nb);
nb = read(0, buf, nb);
display(&my_win, buf, nb);
/* might lose data here because sockt is non-blocking */
for (i = 0; i < nb; ++i)
if (buf[i] == '\r')
buf[i] = '\n';
write(sockt, buf, nb);
}
}