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:
ps 2000-07-11 01:31:39 +00:00
parent 93ea51b60e
commit 4f81558e41

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);
}
}