SCCS-vsn: libexec/telnetd/telnetd.c 5.12
#endif not lint
#ifndef lint
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)telnetd.c 5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)telnetd.c 5.12 (Berkeley) %G%";
net = f, pty = p;
ioctl(f, FIONBIO, &on);
ioctl(p, FIONBIO, &on);
net = f, pty = p;
ioctl(f, FIONBIO, &on);
ioctl(p, FIONBIO, &on);
+#if defined(xxxSO_OOBINLINE)
+ setsockopt(net, SOL_SOCKET, SO_OOBINLINE, on, sizeof on);
+#endif /* defined(xxxSO_OOBINLINE) */
signal(SIGTSTP, SIG_IGN);
signal(SIGCHLD, cleanup);
setpgrp(0, 0);
signal(SIGTSTP, SIG_IGN);
signal(SIGCHLD, cleanup);
setpgrp(0, 0);
* Something to read from the network...
*/
if (FD_ISSET(net, &ibits)) {
* Something to read from the network...
*/
if (FD_ISSET(net, &ibits)) {
-#if !defined(IOCTL_TO_DO_UNIX_OOB_IN_TCP_WAY)
+#if !defined(xxxSO_OOBINLINE)
/*
* In 4.2 (and some early 4.3) systems, the
* OOB indication and data handling in the kernel
/*
* In 4.2 (and some early 4.3) systems, the
* OOB indication and data handling in the kernel
ncc = read(net, netibuf, sizeof (netibuf));
}
settimer(didnetreceive);
ncc = read(net, netibuf, sizeof (netibuf));
}
settimer(didnetreceive);
-#else /* !defined(IOCTL_TO_DO_UNIX_OOB_IN_TCP_WAY) */
+#else /* !defined(xxxSO_OOBINLINE)) */
ncc = read(net, netibuf, sizeof (netibuf));
ncc = read(net, netibuf, sizeof (netibuf));
-#endif /* !defined(IOCTL_TO_DO_UNIX_OOB_IN_TCP_WAY) */
+#endif /* !defined(xxxSO_OOBINLINE)) */
if (ncc < 0 && errno == EWOULDBLOCK)
ncc = 0;
else {
if (ncc < 0 && errno == EWOULDBLOCK)
ncc = 0;
else {
* interrupt. Do this with a NULL or
* interrupt char; depending on the tty mode.
*/
* interrupt. Do this with a NULL or
* interrupt char; depending on the tty mode.
*/
case IP:
interrupt();
break;
case IP:
interrupt();
break;
+ case BREAK:
+ sendbrk();
+ break;
+
'\177' : tchars.t_intrc;
}
'\177' : tchars.t_intrc;
}
+/*
+ * Send quit to process on other side of pty.
+ * If it is in raw mode, just write NULL;
+ * otherwise, write quit char.
+ */
+sendbrk()
+{
+ struct sgttyb b;
+ struct tchars tchars;
+
+ ptyflush(); /* half-hearted */
+ ioctl(pty, TIOCGETP, &b);
+ if (b.sg_flags & RAW) {
+ *pfrontp++ = '\0';
+ return;
+ }
+ *pfrontp++ = ioctl(pty, TIOCGETC, &tchars) < 0 ?
+ '\034' : tchars.t_quitc;
+}
+