pty wants output flushed.
SCCS-vsn: libexec/telnetd/telnetd.c 5.24
#endif not lint
#ifndef lint
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)telnetd.c 5.23 (Berkeley) %G%";
+static char sccsid[] = "@(#)telnetd.c 5.24 (Berkeley) %G%";
ioctl(f, FIONBIO, &on);
ioctl(p, FIONBIO, &on);
ioctl(f, FIONBIO, &on);
ioctl(p, FIONBIO, &on);
+ ioctl(p, TIOCPKT, &on);
#if defined(SO_OOBINLINE)
setsockopt(net, SOL_SOCKET, SO_OOBINLINE, &on, sizeof on);
#endif /* defined(SO_OOBINLINE) */
#if defined(SO_OOBINLINE)
setsockopt(net, SOL_SOCKET, SO_OOBINLINE, &on, sizeof on);
#endif /* defined(SO_OOBINLINE) */
bcopy(BANNER2, nfrontp, sizeof BANNER2 -1);
nfrontp += sizeof BANNER2 - 1;
bcopy(BANNER2, nfrontp, sizeof BANNER2 -1);
nfrontp += sizeof BANNER2 - 1;
+ /* Clear ptybuf[0] - where the packet information is received */
+ ptyibuf[0] = 0;
/*
* Call telrcv() once to pick up anything received during
* terminal type negotiation.
/*
* Call telrcv() once to pick up anything received during
* terminal type negotiation.
*/
if (nfrontp - nbackp || pcc > 0) {
FD_SET(f, &obits);
*/
if (nfrontp - nbackp || pcc > 0) {
FD_SET(f, &obits);
} else {
FD_SET(p, &ibits);
}
} else {
FD_SET(p, &ibits);
}
/*
* Something to read from the pty...
*/
/*
* Something to read from the pty...
*/
+ if (FD_ISSET(p, &xbits)) {
+ if (read(p, ptyibuf, 1) != 1) {
+ break;
+ }
+ }
if (FD_ISSET(p, &ibits)) {
pcc = read(p, ptyibuf, BUFSIZ);
if (pcc < 0 && errno == EWOULDBLOCK)
if (FD_ISSET(p, &ibits)) {
pcc = read(p, ptyibuf, BUFSIZ);
if (pcc < 0 && errno == EWOULDBLOCK)
else {
if (pcc <= 0)
break;
else {
if (pcc <= 0)
break;
+ /* Skip past "packet" */
+ pcc--;
+ ptyip = ptyibuf+1;
+ if (ptyibuf[0] & TIOCPKT_FLUSHWRITE) {
+ netclear(); /* clear buffer back */
+ *nfrontp++ = IAC;
+ *nfrontp++ = DM;
+ neturg = nfrontp-1; /* off by one XXX */
+ ptyibuf[0] = 0;
+ }
while (pcc > 0) {
if ((&netobuf[BUFSIZ] - nfrontp) < 2)
while (pcc > 0) {
if ((&netobuf[BUFSIZ] - nfrontp) < 2)