Blame SOURCES/telnet-client-cvs.patch

fbcb50
diff -uNr telnet/Makefile telnet.obsd-cvs/Makefile
fbcb50
--- telnet/Makefile	Mon Jul 27 18:25:13 1998
fbcb50
+++ telnet.obsd-cvs/Makefile	Sat Mar 10 10:54:26 2001
fbcb50
@@ -36,22 +36,20 @@
fbcb50
 
fbcb50
 PROG=	telnet
fbcb50
 
fbcb50
-CFLAGS+=-DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO -DSKEY -Dunix
fbcb50
-CFLAGS+=-DENV_HACK -D_USE_OLD_CURSES_
fbcb50
+CFLAGS+=-DKLUDGELINEMODE -DUSE_TERMIO -DENV_HACK -DSKEY -Dunix
fbcb50
 CFLAGS+=-I${.CURDIR}/../../lib
fbcb50
-LDADD+=	-locurses -ltelnet
fbcb50
-DPADD=	${LIBOLDCURSES} ${LIBTELNET}
fbcb50
+LDADD+=	-lcurses -ltelnet
fbcb50
+DPADD=	${LIBCURSES} ${LIBTELNET
fbcb50
 
fbcb50
 SRCS=	authenc.c commands.c main.c network.c ring.c sys_bsd.c telnet.c \
fbcb50
 	terminal.c tn3270.c utilities.c
fbcb50
 
fbcb50
 .include <bsd.own.mk> # for KERBEROS
fbcb50
 
fbcb50
-.if (${KERBEROS} == "yes")
fbcb50
+.if (${KERBEROS:L} == "yes")
fbcb50
 CFLAGS+=-DENCRYPTION -DAUTHENTICATION -DKRB4
fbcb50
 LDADD+= -lkrb -ldes
fbcb50
 DPADD+= ${LIBDES} ${LIBKRB}
fbcb50
 .endif
fbcb50
 
fbcb50
 .include <bsd.prog.mk>
fbcb50
-
fbcb50
diff -uNr telnet/commands.c telnet.obsd-cvs/commands.c
fbcb50
--- telnet/commands.c	Fri Apr  9 02:30:20 1999
fbcb50
+++ telnet.obsd-cvs/commands.c	Sat Mar 10 10:51:22 2001
fbcb50
@@ -1,4 +1,4 @@
fbcb50
-/*	$OpenBSD: commands.c,v 1.20 1999/01/04 07:55:05 art Exp $	*/
fbcb50
+/*	$OpenBSD: commands.c,v 1.34 2000/11/08 21:49:44 aaron Exp $	*/
fbcb50
 /*	$NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $	*/
fbcb50
 
fbcb50
 /*
fbcb50
@@ -69,7 +69,7 @@
fbcb50
 	int status;
fbcb50
 
fbcb50
 	if(argc != 3) {
fbcb50
-		printf("%s sequence challenge\n", argv[0]);
fbcb50
+		printf("usage: %s sequence challenge\n", argv[0]);
fbcb50
 		return 0;
fbcb50
 	}
fbcb50
 
fbcb50
@@ -2175,17 +2175,19 @@
fbcb50
     int gotmachine = 0;
fbcb50
     int l1 = strlen(m1);
fbcb50
     int l2 = strlen(m2);
fbcb50
-    char m1save[64];
fbcb50
+    char m1save[MAXHOSTNAMELEN];
fbcb50
 
fbcb50
     if (skiprc)
fbcb50
 	return;
fbcb50
 
fbcb50
-    strcpy(m1save, m1);
fbcb50
+    strncpy(m1save, m1, sizeof(m1save));
fbcb50
     m1 = m1save;
fbcb50
 
fbcb50
     if (rcname[0] == 0) {
fbcb50
 	char *home = getenv("HOME");
fbcb50
 
fbcb50
+	if (home == NULL || *home == '\0')
fbcb50
+	    return;
fbcb50
 	snprintf (rcname, sizeof(rcname), "%s/.telnetrc",
fbcb50
 		  home ? home : "");
fbcb50
     }
fbcb50
@@ -2248,15 +2250,9 @@
fbcb50
     int
fbcb50
 tn(int argc, char *argv[])
fbcb50
 {
fbcb50
-    struct hostent *host = 0, *alias = 0;
fbcb50
-#if defined(AF_INET6)
fbcb50
-    struct sockaddr_in6 sin6;
fbcb50
-#endif
fbcb50
+    struct addrinfo hints, *res, *res0;
fbcb50
+    int error;
fbcb50
     struct sockaddr_in sin;
fbcb50
-    struct sockaddr_in ladr;
fbcb50
-    struct sockaddr *sa;
fbcb50
-    int sa_size;
fbcb50
-    struct servent *sp = 0;
fbcb50
     unsigned long temp;
fbcb50
 #if !defined(__linux__)
fbcb50
     extern char *inet_ntoa();
fbcb50
@@ -2266,15 +2262,18 @@
fbcb50
     int srlen;
fbcb50
 #endif
fbcb50
     char *cmd, *hostp = 0, *portp = 0, *user = 0, *aliasp = 0;
fbcb50
-    int family, port = 0;
fbcb50
-
fbcb50
+    int retry;
fbcb50
+#ifdef NI_WITHSCOPEID
fbcb50
+    const int niflags = NI_NUMERICHOST | NI_WITHSCOPEID;
fbcb50
+#else
fbcb50
+    const int niflags = NI_NUMERICHOST;
fbcb50
+#endif
fbcb50
+    
fbcb50
     /* clear the socket address prior to use */
fbcb50
     memset((char *)&sin, 0, sizeof(sin));
fbcb50
 
fbcb50
     if (connected) {
fbcb50
 	printf("?Already connected to %s\r\n", hostname);
fbcb50
-	seteuid(getuid());
fbcb50
-	setuid(getuid());
fbcb50
 	return 0;
fbcb50
     }
fbcb50
     if (argc < 2) {
fbcb50
@@ -2324,8 +2323,6 @@
fbcb50
 	}
fbcb50
     usage:
fbcb50
 	printf("usage: %s [-l user] [-a] host-name [port]\r\n", cmd);
fbcb50
-	seteuid(getuid());
fbcb50
-	setuid(getuid());
fbcb50
 	return 0;
fbcb50
     }
fbcb50
     if (hostp == 0)
fbcb50
@@ -2340,185 +2337,80 @@
fbcb50
 	temp = sourceroute(hostp, &srp, &srlen);
fbcb50
 	if (temp == 0) {
fbcb50
 	    herror(srp);
fbcb50
-	    seteuid(getuid());
fbcb50
-	    setuid(getuid());
fbcb50
 	    return 0;
fbcb50
 	} else if (temp == -1) {
fbcb50
 	    printf("Bad source route option: %s\r\n", hostp);
fbcb50
-	    seteuid(getuid());
fbcb50
-	    setuid(getuid());
fbcb50
 	    return 0;
fbcb50
 	} else {
fbcb50
 	    abort();
fbcb50
 	}
fbcb50
-    } else {
fbcb50
-#endif
fbcb50
-	memset (&sin, 0, sizeof(sin));
fbcb50
-#if defined(HAVE_INET_PTON) && defined(AF_INET6)
fbcb50
-	memset (&sin6, 0, sizeof(sin6));
fbcb50
-
fbcb50
-	if(inet_pton(AF_INET6, hostp, &sin6.sin6_addr)) {
fbcb50
-	    sin6.sin6_family = family = AF_INET6;
fbcb50
-	    sa = (struct sockaddr *)&sin;;
fbcb50
-	    sa_size = sizeof(sin6);
fbcb50
-	    strcpy(_hostname, hostp);
fbcb50
-	    hostname =_hostname;
fbcb50
-	} else
fbcb50
-#endif
fbcb50
-	    if(inet_aton(hostp, &sin.sin_addr)){
fbcb50
-		sin.sin_family = family = AF_INET;
fbcb50
-		sa = (struct sockaddr *)&sin;
fbcb50
-		sa_size = sizeof(sin);
fbcb50
-		strcpy(_hostname, hostp);
fbcb50
-		hostname = _hostname;
fbcb50
-	    } else {
fbcb50
-#ifdef HAVE_GETHOSTBYNAME2
fbcb50
-		host = gethostbyname2(hostp, AF_INET6);
fbcb50
-		if(host == NULL)
fbcb50
-		    host = gethostbyname2(hostp, AF_INET);
fbcb50
-#else
fbcb50
-		host = gethostbyname(hostp);
fbcb50
-#endif
fbcb50
-		if (host) {
fbcb50
-		    strncpy(_hostname, host->h_name, sizeof(_hostname));
fbcb50
-		    family = host->h_addrtype;
fbcb50
-
fbcb50
-		    switch(family) {
fbcb50
-		    case AF_INET:
fbcb50
-			memset(&sin, 0, sizeof(sin));
fbcb50
-			sa_size = sizeof(sin);
fbcb50
-			sa = (struct sockaddr *)&sin;
fbcb50
-			sin.sin_family = family;
fbcb50
-
fbcb50
-			memcpy(&sin.sin_addr, *host->h_addr_list, sizeof(struct in_addr));
fbcb50
-			break;
fbcb50
-#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6)
fbcb50
-		    case AF_INET6:
fbcb50
-			memset(&sin6, 0, sizeof(sin6));
fbcb50
-			sa_size = sizeof(sin6);
fbcb50
-			sa = (struct sockaddr *)&sin;;
fbcb50
-			sin6.sin6_family = family;
fbcb50
-			memcpy(&sin6.sin6_addr, *host->h_addr_list, sizeof(struct in6_addr));
fbcb50
-			break;
fbcb50
-#endif
fbcb50
-		    default:
fbcb50
-			fprintf(stderr, "Bad address family: %d\n", family);
fbcb50
-			return 0;
fbcb50
-		    }
fbcb50
-		    
fbcb50
-		    _hostname[sizeof(_hostname)-1] = '\0';
fbcb50
-		    hostname = _hostname;
fbcb50
-		} else {
fbcb50
-		    herror(hostp);
fbcb50
-		    seteuid(getuid());
fbcb50
-		    setuid(getuid());
fbcb50
-		    return 0;
fbcb50
-		}
fbcb50
-	    }
fbcb50
-#if	defined(IP_OPTIONS) && defined(IPPROTO_IP)
fbcb50
-    }
fbcb50
+    } else
fbcb50
 #endif
fbcb50
-    if (portp) {
fbcb50
-	if (*portp == '-') {
fbcb50
-	    portp++;
fbcb50
-	    telnetport = 1;
fbcb50
-	} else
fbcb50
-	    telnetport = 0;
fbcb50
-	port = atoi(portp);
fbcb50
-	if (port == 0) {
fbcb50
-	    sp = getservbyname(portp, "tcp");
fbcb50
-	    if (sp)
fbcb50
-		port = sp->s_port;
fbcb50
-	    else {
fbcb50
-		printf("%s: bad port number\r\n", portp);
fbcb50
-		seteuid(getuid());
fbcb50
-		setuid(getuid());
fbcb50
-		return 0;
fbcb50
-	    }
fbcb50
-	} else {
fbcb50
-	    port = htons(port);
fbcb50
-	}
fbcb50
-    } else {
fbcb50
-	if (sp == 0) {
fbcb50
-	    sp = getservbyname("telnet", "tcp");
fbcb50
-	    if (sp == 0) {
fbcb50
-		fprintf(stderr, "telnet: tcp/telnet: unknown service\r\n");
fbcb50
-		seteuid(getuid());
fbcb50
-		setuid(getuid());
fbcb50
-		return 0;
fbcb50
-	    }
fbcb50
-	    port = sp->s_port;
fbcb50
+    {
fbcb50
+	hostname = hostp;
fbcb50
+	memset(&hints, 0, sizeof(hints));
fbcb50
+	hints.ai_family = PF_UNSPEC;
fbcb50
+	hints.ai_socktype = SOCK_STREAM;
fbcb50
+	hints.ai_flags = AI_CANONNAME;
fbcb50
+	if (portp == NULL) {
fbcb50
+		portp = "telnet";
fbcb50
+	} else if (*portp == '-') {
fbcb50
+		portp++;
fbcb50
+		telnetport = 1;
fbcb50
+	}
fbcb50
+	h_errno = 0;
fbcb50
+	error = getaddrinfo(hostp, portp, &hints, &res0);
fbcb50
+	if (error) {
fbcb50
+	    if (error == EAI_SERVICE)
fbcb50
+	        warnx("%s: bad port", portp);
fbcb50
+	    else
fbcb50
+		warnx("%s: %s", hostp, gai_strerror(error));
fbcb50
+	   if (h_errno)
fbcb50
+		herror(hostp);
fbcb50
+	   return 0;
fbcb50
 	}
fbcb50
-	telnetport = 1;
fbcb50
     }
fbcb50
-    switch(family) {
fbcb50
-    case AF_INET:
fbcb50
-	sin.sin_port = port;
fbcb50
-	printf("Trying %s...\r\n", inet_ntoa(sin.sin_addr));
fbcb50
-	break;
fbcb50
-#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6)
fbcb50
-    case AF_INET6: {
fbcb50
-#ifndef INET6_ADDRSTRLEN
fbcb50
-#define INET6_ADDRSTRLEN 46 
fbcb50
-#endif
fbcb50
 
fbcb50
-	char buf[INET6_ADDRSTRLEN];
fbcb50
-
fbcb50
-	sin6.sin6_port = port;
fbcb50
-#ifdef HAVE_INET_NTOP
fbcb50
-	printf("Trying %s...\r\n", inet_ntop(AF_INET6,
fbcb50
-					     &sin6.sin6_addr,
fbcb50
-					     buf,
fbcb50
-					     sizeof(buf)));
fbcb50
-#endif
fbcb50
-	break;
fbcb50
-    }
fbcb50
-#endif
fbcb50
-    default:
fbcb50
-	abort();
fbcb50
-    }
fbcb50
-
fbcb50
-    do {
fbcb50
-	net = socket(family, SOCK_STREAM, 0);
fbcb50
-	seteuid(getuid());
fbcb50
-	setuid(getuid());
fbcb50
-	if (net < 0) {
fbcb50
-	    perror("telnet: socket");
fbcb50
-	    return 0;
fbcb50
+    net = -1;
fbcb50
+    retry = 0;
fbcb50
+    for (res = res0; res; res = res->ai_next) {
fbcb50
+	if (1 /* retry */) {
fbcb50
+	    char hbuf[NI_MAXHOST];
fbcb50
+	    
fbcb50
+	    if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf),
fbcb50
+	            NULL, 0, niflags) != 0) {
fbcb50
+		strcpy(hbuf, "(invalid)");
fbcb50
+	    }
fbcb50
+	    printf("Trying %s...\r\n", hbuf);
fbcb50
 	}
fbcb50
+	net = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
fbcb50
+	if (net < 0)
fbcb50
+	    continue;
fbcb50
+	    
fbcb50
 	if (aliasp) {
fbcb50
-	    memset ((caddr_t)&ladr, 0, sizeof (ladr));
fbcb50
-	    temp = inet_addr(aliasp);
fbcb50
-	    if (temp != INADDR_NONE) {
fbcb50
-	        ladr.sin_addr.s_addr = temp;
fbcb50
-	        ladr.sin_family = AF_INET;
fbcb50
-	        alias = gethostbyaddr((char *)&temp, sizeof(temp), AF_INET);
fbcb50
-	    } else {
fbcb50
-	        alias = gethostbyname(aliasp);
fbcb50
-	        if (alias) {
fbcb50
-		    ladr.sin_family = alias->h_addrtype;
fbcb50
-#if	defined(h_addr)		/* In 4.3, this is a #define */
fbcb50
-		    memmove((caddr_t)&ladr.sin_addr,
fbcb50
-			alias->h_addr_list[0], alias->h_length);
fbcb50
-#else	/* defined(h_addr) */
fbcb50
-		    memmove((caddr_t)&ladr.sin_addr, alias->h_addr,
fbcb50
-			alias->h_length);
fbcb50
-#endif	/* defined(h_addr) */
fbcb50
-	        } else {
fbcb50
-		    herror(aliasp);
fbcb50
-		    return 0;
fbcb50
-	        }
fbcb50
+	    struct addrinfo ahints, *ares;
fbcb50
+	    memset(&ahints, 0, sizeof(ahints));
fbcb50
+	    ahints.ai_family = PF_UNSPEC;
fbcb50
+	    ahints.ai_socktype = SOCK_STREAM;
fbcb50
+	    ahints.ai_flags = AI_PASSIVE;
fbcb50
+	    error = getaddrinfo(aliasp, "0", &ahints, &ares);
fbcb50
+	    if (error) {
fbcb50
+	        warn("%s: %s", aliasp, gai_strerror(error));
fbcb50
+	        close(net);
fbcb50
+	        freeaddrinfo(ares);
fbcb50
+	        continue;
fbcb50
 	    }
fbcb50
-            ladr.sin_port = htons(0);
fbcb50
-  
fbcb50
-            if (bind (net, (struct sockaddr *)&ladr, sizeof(ladr)) < 0) {
fbcb50
-                perror(aliasp);; 
fbcb50
+	    if (bind(net, ares->ai_addr, ares->ai_addrlen) < 0) {
fbcb50
+	        perror(aliasp);
fbcb50
                 (void) close(net);   /* dump descriptor */
fbcb50
-		return 0;
fbcb50
+		freeaddrinfo(ares);
fbcb50
+		continue;
fbcb50
             }
fbcb50
+	    freeaddrinfo(ares);
fbcb50
         }
fbcb50
  #if	defined(IP_OPTIONS) && defined(IPPROTO_IP)
fbcb50
-	if (srp && setsockopt(net, IPPROTO_IP, IP_OPTIONS, (char *)srp, srlen) < 0)
fbcb50
+	if (srp && res->ai_family == AF_INET
fbcb50
+	 && setsockopt(net, IPPROTO_IP, IP_OPTIONS, (char *)srp, srlen) < 0)
fbcb50
 		perror("setsockopt (IP_OPTIONS)");
fbcb50
 #endif
fbcb50
 #if	defined(IPPROTO_IP) && defined(IP_TOS)
fbcb50
@@ -2542,65 +2434,32 @@
fbcb50
 		perror("setsockopt (SO_DEBUG)");
fbcb50
 	}
fbcb50
 
fbcb50
-	if (connect(net, sa, sa_size) < 0) {
fbcb50
-	    int retry = 0;
fbcb50
-
fbcb50
-	    if (host && host->h_addr_list[1]) {
fbcb50
-		int oerrno = errno;
fbcb50
-	        retry = 1;
fbcb50
-
fbcb50
-		switch(family) {
fbcb50
-		case AF_INET :
fbcb50
-		    fprintf(stderr, "telnet: connect to address %s: ",
fbcb50
-			    inet_ntoa(sin.sin_addr));
fbcb50
-		    ++host->h_addr_list;
fbcb50
-		    memcpy(&sin.sin_addr, *host->h_addr_list, sizeof(struct in_addr));
fbcb50
-		    break;
fbcb50
-#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6)
fbcb50
-		case AF_INET6: {
fbcb50
-		    char buf[INET6_ADDRSTRLEN];
fbcb50
-
fbcb50
-		    fprintf(stderr, "telnet: connect to address %s: ",
fbcb50
-			    inet_ntop(AF_INET6, &sin6.sin6_addr, buf,
fbcb50
-				      sizeof(buf)));
fbcb50
-		    ++host->h_addr_list;
fbcb50
-		    memcpy(&sin6.sin6_addr, *host->h_addr_list, sizeof(struct in6_addr));
fbcb50
-		    break;
fbcb50
-		}
fbcb50
-#endif
fbcb50
-		default:
fbcb50
-		    abort();
fbcb50
-		}
fbcb50
-                   
fbcb50
-		errno = oerrno;
fbcb50
-		perror(NULL);
fbcb50
-
fbcb50
-		switch(family) {
fbcb50
-		case AF_INET :
fbcb50
-			printf("Trying %s...\r\n", inet_ntoa(sin.sin_addr));
fbcb50
-			break;
fbcb50
-#if defined(AF_INET6) && defined(HAVE_STRUCT_SOCKADDR_IN6)
fbcb50
-		case AF_INET6: {
fbcb50
-		    printf("Trying %s...\r\n", inet_ntop(AF_INET6,
fbcb50
-					     &sin6.sin6_addr,
fbcb50
-					     buf,
fbcb50
-					     sizeof(buf)));
fbcb50
-		    break;
fbcb50
-		}
fbcb50
-#endif
fbcb50
-		}
fbcb50
-		
fbcb50
-		(void) NetClose(net);
fbcb50
-		continue;
fbcb50
+	if (connect(net, res->ai_addr, res->ai_addrlen) < 0) {
fbcb50
+	    char hbuf[NI_MAXHOST];
fbcb50
+	    
fbcb50
+	    if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf),
fbcb50
+		    NULL, 0, NI_NUMERICHOST) != 0) {
fbcb50
+	        strcpy(hbuf, "(invalid)");
fbcb50
 	    }
fbcb50
-	    perror("telnet: Unable to connect to remote host");
fbcb50
-	    return 0;
fbcb50
+	    fprintf(stderr, "telnet: connect to address %s: %s\n", hbuf,
fbcb50
+	        strerror(errno));
fbcb50
+	
fbcb50
+	    close(net);
fbcb50
+	    net = -1;
fbcb50
+	    retry++;
fbcb50
+	    continue;
fbcb50
 	}
fbcb50
+
fbcb50
 	connected++;
fbcb50
 #if	defined(AUTHENTICATION) || defined(ENCRYPTION)
fbcb50
 	auth_encrypt_connect(connected);
fbcb50
 #endif	/* defined(AUTHENTICATION) */
fbcb50
-    } while (connected == 0);
fbcb50
+	break;
fbcb50
+    }
fbcb50
+    freeaddrinfo(res0);
fbcb50
+    if (net < 0) {
fbcb50
+        return 0;
fbcb50
+    }
fbcb50
     cmdrc(hostp, hostname);
fbcb50
     if (autologin && user == NULL) {
fbcb50
 	struct passwd *pw;
fbcb50
@@ -2652,6 +2511,9 @@
fbcb50
         encrypthelp[] = "turn on (off) encryption ('encrypt ?' for more)",
fbcb50
 #endif
fbcb50
 	zhelp[] =	"suspend telnet",
fbcb50
+#ifdef SKEY
fbcb50
+	skeyhelp[] =	"compute response to s/key challenge",
fbcb50
+#endif
fbcb50
 	shellhelp[] =	"invoke a subshell",
fbcb50
 	envhelp[] =	"change environment variables ('environ ?' for more)",
fbcb50
 	modestring[] = "try to enter line or character mode ('mode ?' for more)";
fbcb50
@@ -2690,7 +2552,7 @@
fbcb50
 	{ "environ",	envhelp,	env_cmd,	0 },
fbcb50
 	{ "?",		helphelp,	help,		0 },
fbcb50
 #if	defined(SKEY)
fbcb50
-	{ "skey",	NULL,		skey_calc,	0 },
fbcb50
+	{ "skey",	skeyhelp,	skey_calc,	0 },
fbcb50
 #endif		
fbcb50
 	{ 0,		0,		0,		0 }
fbcb50
 };
fbcb50
diff -uNr telnet/externs.h telnet.obsd-cvs/externs.h
fbcb50
--- telnet/externs.h	Mon Feb  8 22:56:11 1999
fbcb50
+++ telnet.obsd-cvs/externs.h	Sat Mar 10 10:54:35 2001
fbcb50
@@ -1,4 +1,4 @@
fbcb50
-/*	$OpenBSD: externs.h,v 1.4 1998/03/12 17:31:32 deraadt Exp $	*/
fbcb50
+/*	$OpenBSD: externs.h,v 1.5 1998/03/12 2001/01/22 11:03:38 fgsch Exp $	*/
fbcb50
 /* $KTH: externs.h,v 1.16 1997/11/29 02:28:35 joda Exp $ */
fbcb50
 
fbcb50
 /*
fbcb50
@@ -447,7 +447,7 @@
fbcb50
     *Ibackp,           /* Oldest byte of 3270 data */
fbcb50
     Ibuf[],            /* 3270 buffer */
fbcb50
     *Ifrontp,          /* Where next 3270 byte goes */
fbcb50
-    tline[],
fbcb50
+    tline[200],
fbcb50
     *transcom;         /* Transparent command */
fbcb50
 
fbcb50
 extern int
fbcb50
diff -uNr telnet/main.c telnet.obsd-cvs/main.c
fbcb50
--- telnet/main.c	Wed Apr  7 23:23:35 1999
fbcb50
+++ telnet.obsd-cvs/main.c	Sat Mar 10 09:59:35 2001
fbcb50
@@ -1,4 +1,4 @@
fbcb50
-/*	$OpenBSD: main.c,v 1.7 1998/05/15 03:16:38 art Exp $	*/
fbcb50
+/*	$OpenBSD: main.c,v 1.10 2001/01/21 22:46:37 aaron Exp $	*/
fbcb50
 /*	$NetBSD: main.c,v 1.5 1996/02/28 21:04:05 thorpej Exp $	*/
fbcb50
 
fbcb50
 /*
fbcb50
@@ -81,10 +81,10 @@
fbcb50
 	    prompt,
fbcb50
 #ifdef	AUTHENTICATION
fbcb50
 	    "[-8] [-E] [-K] [-L] [-S tos] [-X atype] [-a] [-c] [-d] [-e char]",
fbcb50
-	    "\n\t[-k realm] [-l user] [-f/-F] [-n tracefile] [-b hostalias ]",
fbcb50
+	    "\n\t[-k realm] [-l user] [-f/-F] [-n tracefile] [-b hostalias ] ",
fbcb50
 #else
fbcb50
 	    "[-8] [-E] [-L] [-S tos] [-a] [-c] [-d] [-e char] [-l user]",
fbcb50
-	    "\n\t[-n tracefile] [-b hostalias ]",
fbcb50
+	    "\n\t[-n tracefile] [-b hostalias ] ",
fbcb50
 #endif
fbcb50
 #if defined(TN3270) && defined(unix)
fbcb50
 # ifdef AUTHENTICATION
fbcb50
@@ -95,13 +95,11 @@
fbcb50
 #else
fbcb50
 	    "[-r] ",
fbcb50
 #endif
fbcb50
+	    "\n\r "
fbcb50
 #ifdef ENCRYPTION
fbcb50
-	    "[-x] [host-name [port]]"
fbcb50
-#else
fbcb50
-
fbcb50
-	    "[host-name [port]]"
fbcb50
+	    "[-x] " 
fbcb50
 #endif
fbcb50
-	);
fbcb50
+	    "[host-name [port]]");
fbcb50
 	exit(1);
fbcb50
 }
fbcb50
 
fbcb50
@@ -276,8 +274,8 @@
fbcb50
 			break;
fbcb50
 		case 't':
fbcb50
 #if defined(TN3270) && defined(unix)
fbcb50
+			(void)strncpy(tline, optarg, sizeof(tline));
fbcb50
 			transcom = tline;
fbcb50
-			(void)strcpy(transcom, optarg);
fbcb50
 #else
fbcb50
 			fprintf(stderr,
fbcb50
 			   "%s: Warning: -t ignored, no TN3270 support.\n",
fbcb50
diff -uNr telnet/sys_bsd.c telnet.obsd-cvs/sys_bsd.c
fbcb50
--- telnet/sys_bsd.c	Wed Apr  7 21:38:31 1999
fbcb50
+++ telnet.obsd-cvs/sys_bsd.c	Sat Mar 10 10:55:18 2001
fbcb50
@@ -1,4 +1,4 @@
fbcb50
-/*	$OpenBSD: sys_bsd.c,v 1.6 1998/12/28 11:13:51 deraadt Exp $	*/
fbcb50
+/*	$OpenBSD: sys_bsd.c,v 1.8 2000/10/10 15:41:10 millert Exp $	*/
fbcb50
 /*	$NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $	*/
fbcb50
 
fbcb50
 /*
fbcb50
@@ -35,6 +35,7 @@
fbcb50
  */
fbcb50
 
fbcb50
 #include "telnet_locl.h"
fbcb50
+#include <err.h>
fbcb50
 
fbcb50
 /*
fbcb50
  * The following routines try to encapsulate what is system dependent
fbcb50
@@ -198,9 +199,10 @@
fbcb50
 TerminalFlushOutput(void)
fbcb50
 {
fbcb50
 #ifdef	TIOCFLUSH
fbcb50
-    (void) ioctl(fileno(stdout), TIOCFLUSH, (char *) 0);
fbcb50
+    int com = FWRITE;
fbcb50
+    (void) ioctl(fileno(stdout), TIOCFLUSH, (int *) &com);
fbcb50
 #else
fbcb50
-    (void) ioctl(fileno(stdout), TCFLSH, (char *) 0);
fbcb50
+    (void) ioctl(fileno(stdout), TCFLSH, (int *) 0);
fbcb50
 #endif
fbcb50
 }
fbcb50
 
fbcb50
diff -uNr telnet/telnet.c telnet.obsd-cvs/telnet.c
fbcb50
--- telnet/telnet.c	Wed Apr  7 23:22:14 1999
fbcb50
+++ telnet.obsd-cvs/telnet.c	Sat Mar 10 11:02:34 2001
fbcb50
@@ -1,4 +1,4 @@
fbcb50
-/*	$OpenBSD: telnet.c,v 1.6 1998/07/27 15:29:29 millert Exp $	*/
fbcb50
+/*	$OpenBSD: telnet.c,v 1.11 2000/11/10 15:33:13 provos millert Exp $	*/
fbcb50
 /*	$NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $	*/
fbcb50
 
fbcb50
 /*
fbcb50
@@ -35,6 +35,8 @@
fbcb50
  */
fbcb50
 
fbcb50
 #include "telnet_locl.h"
fbcb50
+#include <curses.h>
fbcb50
+#include <term.h>
fbcb50
 
fbcb50
 #define        strip(x) (eight ? (x) : ((x) & 0x7f))
fbcb50
 
fbcb50
@@ -523,10 +525,9 @@
fbcb50
 }
fbcb50
 
fbcb50
 /*
fbcb50
- * Given a buffer returned by tgetent(), this routine will turn
fbcb50
- * the pipe seperated list of names in the buffer into an array
fbcb50
- * of pointers to null terminated names.  We toss out any bad,
fbcb50
- * duplicate, or verbose names (names with spaces).
fbcb50
+ * This routine will turn a pipe seperated list of names in the buffer
fbcb50
+ * into an array of pointers to NUL terminated names.  We toss out any
fbcb50
+ * bad, duplicate, or verbose names (names with spaces).
fbcb50
  */
fbcb50
 
fbcb50
 int is_unique P((char *, char **, char **));
fbcb50
@@ -554,7 +555,7 @@
fbcb50
 	/*
fbcb50
 	 * Count up the number of names.
fbcb50
 	 */
fbcb50
-	for (n = 1, cp = buf; *cp && *cp != ':'; cp++) {
fbcb50
+	for (n = 1, cp = buf; *cp; cp++) {
fbcb50
 		if (*cp == '|')
fbcb50
 			n++;
fbcb50
 	}
fbcb50
@@ -659,25 +660,6 @@
fbcb50
 	return (1);
fbcb50
 }
fbcb50
 
fbcb50
-static char termbuf[1024];
fbcb50
-
fbcb50
-int telnet_setupterm	P((char *tname, int fd, int *errp)); /* XXX move elsewhere */
fbcb50
-	/*ARGSUSED*/
fbcb50
-	int
fbcb50
-telnet_setupterm(char *tname, int fd, int *errp)
fbcb50
-{
fbcb50
-	(void)fd;
fbcb50
-	if (tgetent(termbuf, tname) == 1) {
fbcb50
-		termbuf[1023] = '\0';
fbcb50
-		if (errp)
fbcb50
-			*errp = 1;
fbcb50
-		return(0);
fbcb50
-	}
fbcb50
-	if (errp)
fbcb50
-		*errp = 0;
fbcb50
-	return(-1);
fbcb50
-}
fbcb50
-
fbcb50
 int resettermname = 1;
fbcb50
 
fbcb50
 char *gettermname P((void));	/* XXX move elsewhere */
fbcb50
@@ -687,15 +669,15 @@
fbcb50
 	char *tname;
fbcb50
 	static char **tnamep = 0;
fbcb50
 	static char **next;
fbcb50
-	int err;
fbcb50
+	int errret;
fbcb50
 
fbcb50
 	if (resettermname) {
fbcb50
 		resettermname = 0;
fbcb50
 		if (tnamep && tnamep != unknown)
fbcb50
 			free(tnamep);
fbcb50
 		if ((tname = (char *)env_getvalue((unsigned char *)"TERM")) &&
fbcb50
-				(telnet_setupterm(tname, 1, &err) == 0)) {
fbcb50
-			tnamep = mklist(termbuf, tname);
fbcb50
+				(setupterm(tname, 1, &errret) == 0)) {
fbcb50
+			tnamep = mklist(ttytype, tname);
fbcb50
 		} else {
fbcb50
 			if (tname && ((int)strlen(tname) <= 40)) {
fbcb50
 				unknown[0] = tname;
fbcb50
@@ -1482,10 +1464,15 @@
fbcb50
 	void
fbcb50
 env_opt_start(void)
fbcb50
 {
fbcb50
-	if (opt_reply)
fbcb50
-		opt_reply = (unsigned char *)realloc(opt_reply, OPT_REPLY_SIZE);
fbcb50
-	else
fbcb50
-		opt_reply = (unsigned char *)malloc(OPT_REPLY_SIZE);
fbcb50
+	unsigned char *p;
fbcb50
+	
fbcb50
+	if (opt_reply) {
fbcb50
+		p = (unsigned char *)realloc(opt_reply, OPT_REPLY_SIZE);
fbcb50
+		if (p == NULL)
fbcb50
+			free(opt_reply);
fbcb50
+	} else
fbcb50
+		p = (unsigned char *)malloc(OPT_REPLY_SIZE);
fbcb50
+	opt_reply = p;	
fbcb50
 	if (opt_reply == NULL) {
fbcb50
 /*@*/		printf("env_opt_start: malloc()/realloc() failed!!!\n");
fbcb50
 		opt_reply = opt_replyp = opt_replyend = NULL;
fbcb50
@@ -1532,9 +1519,13 @@
fbcb50
 				strlen((char *)ep) + 6 > opt_replyend)
fbcb50
 	{
fbcb50
 		int len;
fbcb50
+		unsigned char *p;
fbcb50
 		opt_replyend += OPT_REPLY_SIZE;
fbcb50
 		len = opt_replyend - opt_reply;
fbcb50
-		opt_reply = (unsigned char *)realloc(opt_reply, len);
fbcb50
+		p = (unsigned char *)realloc(opt_reply, len);
fbcb50
+		if (p == NULL)
fbcb50
+			free(opt_reply);
fbcb50
+		opt_reply = p;
fbcb50
 		if (opt_reply == NULL) {
fbcb50
 /*@*/			printf("env_opt_add: realloc() failed!!!\n");
fbcb50
 			opt_reply = opt_replyp = opt_replyend = NULL;
fbcb50
@@ -1945,7 +1936,7 @@
fbcb50
 				command(0, "z\n", 2);
fbcb50
 				continue;
fbcb50
 			}
fbcb50
-			if (sc == escape) {
fbcb50
+			if (sc == escape && escape != _POSIX_VDISABLE) {
fbcb50
 				command(0, (char *)tbp, tcc);
fbcb50
 				bol = 1;
fbcb50
 				count += tcc;
fbcb50
@@ -1962,7 +1953,7 @@
fbcb50
 		}
fbcb50
 		if ((sc == '\n') || (sc == '\r'))
fbcb50
 			bol = 1;
fbcb50
-	} else if (sc == escape) {
fbcb50
+	} else if (sc == escape && escape != _POSIX_VDISABLE) {
fbcb50
 	    /*
fbcb50
 	     * Double escape is a pass through of a single escape character.
fbcb50
 	     */
fbcb50
diff -uNr telnet/telnet_locl.h telnet.obsd-cvs/telnet_locl.h
fbcb50
--- telnet/telnet_locl.h	Thu Mar 12 06:57:44 1998
fbcb50
+++ telnet.obsd-cvs/telnet_locl.h	Sat Mar 10 11:12:37 2001
fbcb50
@@ -1,4 +1,4 @@
fbcb50
-/*	$OpenBSD: telnet_locl.h,v 1.1 1998/03/12 04:57:44 art Exp $	*/
fbcb50
+/*	$OpenBSD: telnet_locl.h,v 1.2 1999/12/11 09:08:09 itojun Exp $	*/
fbcb50
 /* $KTH: telnet_locl.h,v 1.13 1997/11/03 21:37:55 assar Exp $ */
fbcb50
 
fbcb50
 /*
fbcb50
@@ -86,7 +86,5 @@
fbcb50
 #include "defines.h"
fbcb50
 #include "types.h"
fbcb50
 
fbcb50
-#undef AF_INET6 /* XXX - it has not been tested and it doesn't exist yet */
fbcb50
-
fbcb50
 /* prototypes */
fbcb50
 
fbcb50
diff -uNr libtelnet/kerberos.c libtelnet.obsd-cvs/kerberos.c
fbcb50
--- libtelnet/kerberos.c	Mon Feb  8 23:38:17 1999
fbcb50
+++ libtelnet.obsd-cvs/kerberos.c	Sat Mar 10 11:11:03 2001
fbcb50
@@ -320,11 +320,10 @@
fbcb50
 	    char ts[MAXPATHLEN];
fbcb50
 	    struct passwd *pw = getpwnam(UserNameRequested);
fbcb50
 
fbcb50
-	    if(pw){
fbcb50
+	    if (pw) {
fbcb50
 		snprintf(ts, sizeof(ts),
fbcb50
-			 "%s%u",
fbcb50
-			 TKT_ROOT,
fbcb50
-			 (unsigned)pw->pw_uid);
fbcb50
+			"%s%u", TKT_ROOT, (unsigned)pw->pw_uid);
fbcb50
+		/* XXX allocation failure? */
fbcb50
 		setenv("KRBTKFILE", ts, 1);
fbcb50
 	    }
fbcb50
 	    Data(ap, KRB_ACCEPT, NULL, 0);
fbcb50
@@ -609,16 +608,26 @@
fbcb50
 {
fbcb50
     unsigned char *p = buf;
fbcb50
     
fbcb50
-    p += krb_put_nir(cred->service, cred->instance, cred->realm, p);
fbcb50
+    memcpy (p, cred->service, ANAME_SZ);
fbcb50
+    p += ANAME_SZ;
fbcb50
+    memcpy (p, cred->instance, INST_SZ);
fbcb50
+    p += INST_SZ;
fbcb50
+    memcpy (p, cred->realm, REALM_SZ);
fbcb50
+    p += REALM_SZ;
fbcb50
     memcpy(p, cred->session, 8);
fbcb50
     p += 8;
fbcb50
     *p++ = cred->lifetime;
fbcb50
     *p++ = cred->kvno;
fbcb50
-    p += krb_put_int(cred->ticket_st.length, p, 4);
fbcb50
+    p += krb_put_int(cred->ticket_st.length, p, 4, 4);
fbcb50
     memcpy(p, cred->ticket_st.dat, cred->ticket_st.length);
fbcb50
     p += cred->ticket_st.length;
fbcb50
-    p += krb_put_int(cred->issue_date, p, 4);
fbcb50
-    p += krb_put_nir(cred->pname, cred->pinst, NULL, p);
fbcb50
+    p += krb_put_int(cred->issue_date, p, 4, 4);
fbcb50
+    strncpy (cred->pname, p, ANAME_SZ);
fbcb50
+    cred->pname[ANAME_SZ - 1] = '\0';
fbcb50
+    p += ANAME_SZ;
fbcb50
+    strncpy (cred->pinst, p, INST_SZ);
fbcb50
+    cred->pinst[INST_SZ - 1] = '\0';
fbcb50
+    p += INST_SZ;
fbcb50
     return p - buf;
fbcb50
 }
fbcb50
 
fbcb50
@@ -627,7 +636,16 @@
fbcb50
 {
fbcb50
     unsigned char *p = buf;
fbcb50
 
fbcb50
-    p += krb_get_nir(p, cred->service, cred->instance, cred->realm);
fbcb50
+    strncpy (cred->service, p, ANAME_SZ);
fbcb50
+    cred->service[ANAME_SZ - 1] = '\0';
fbcb50
+    p += ANAME_SZ;
fbcb50
+    strncpy (cred->instance, p, INST_SZ);
fbcb50
+    cred->instance[INST_SZ - 1] = '\0';
fbcb50
+    p += INST_SZ;
fbcb50
+    strncpy (cred->realm, p, REALM_SZ);
fbcb50
+    cred->realm[REALM_SZ - 1] = '\0';
fbcb50
+    p += REALM_SZ;
fbcb50
+
fbcb50
     memcpy(cred->session, p, 8);
fbcb50
     p += 8;
fbcb50
     cred->lifetime = *p++;
fbcb50
@@ -636,7 +654,10 @@
fbcb50
     memcpy(cred->ticket_st.dat, p, cred->ticket_st.length);
fbcb50
     cred->ticket_st.mbz = 0;
fbcb50
     p += krb_get_int(p, (u_int32_t *)&cred->issue_date, 4, 0);
fbcb50
-    p += krb_get_nir(p, cred->pname, cred->pinst, NULL);
fbcb50
+    p += krb_get_nir(p, 
fbcb50
+		    cred->pname, sizeof(cred->pname),
fbcb50
+		    cred->pinst, sizeof(cred->pinst),
fbcb50
+		    NULL, 0);
fbcb50
     return 0;
fbcb50
 }
fbcb50
 
fbcb50
--- telnet/telnet.1	Thu Nov 12 01:01:46 1998
fbcb50
+++ telnet.obsd-cvs/telnet.1	Thu Nov  9 19:52:41 2000
fbcb50
@@ -1,4 +1,4 @@
fbcb50
-.\"	$OpenBSD: telnet.1,v 1.14 1998/11/11 23:01:46 aaron Exp $
fbcb50
+.\"	$OpenBSD: telnet.1,v 1.27 2000/11/09 17:52:41 aaron Exp $
fbcb50
 .\"	$NetBSD: telnet.1,v 1.5 1996/02/28 21:04:12 thorpej Exp $
fbcb50
 .\"
fbcb50
 .\" Copyright (c) 1983, 1990, 1993
fbcb50
@@ -36,45 +36,34 @@
fbcb50
 .\"
fbcb50
 .Dd February 3, 1994
fbcb50
 .Dt TELNET 1
fbcb50
-.Os BSD 4.2
fbcb50
+.Os
fbcb50
 .Sh NAME
fbcb50
 .Nm telnet
fbcb50
-.Nd user interface to the 
fbcb50
+.Nd user interface to the
fbcb50
 .Tn TELNET
fbcb50
 protocol
fbcb50
 .Sh SYNOPSIS
fbcb50
 .Nm telnet
fbcb50
-.Op Fl 8
fbcb50
-.Op Fl E
fbcb50
-.Op Fl F
fbcb50
-.Op Fl K
fbcb50
-.Op Fl L
fbcb50
-.Op Fl S Ar tos
fbcb50
+.Op Fl 8EFKLacdfrx
fbcb50
 .Op Fl X Ar authtype
fbcb50
-.Op Fl a
fbcb50
 .Op Fl b Ar hostalias
fbcb50
-.Op Fl c
fbcb50
-.Op Fl d
fbcb50
 .Op Fl e Ar escapechar
fbcb50
-.Op Fl f
fbcb50
 .Op Fl k Ar realm
fbcb50
 .Op Fl l Ar user
fbcb50
 .Op Fl n Ar tracefile
fbcb50
-.Op Fl r
fbcb50
-.Op Fl x
fbcb50
 .Oo
fbcb50
 .Ar host
fbcb50
 .Op Ar port
fbcb50
 .Oc
fbcb50
 .Sh DESCRIPTION
fbcb50
 The
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 command
fbcb50
-is used to communicate with another host using the 
fbcb50
+is used to communicate with another host using the
fbcb50
 .Tn TELNET
fbcb50
 protocol.
fbcb50
 If
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is invoked without the
fbcb50
 .Ar host
fbcb50
 argument, it enters command mode,
fbcb50
@@ -85,11 +74,11 @@
fbcb50
 .Ic open
fbcb50
 command with those arguments.
fbcb50
 .Pp
fbcb50
-Options:
fbcb50
-.Bl -tag -width indent
fbcb50
+The options are as follows:
fbcb50
+.Bl -tag -width Ds
fbcb50
 .It Fl 8
fbcb50
-Specifies an 8-bit data path.  This causes an attempt to
fbcb50
-negotiate the
fbcb50
+Specifies an 8-bit data path.
fbcb50
+This causes an attempt to negotiate the
fbcb50
 .Dv TELNET BINARY
fbcb50
 option on both input and output.
fbcb50
 .It Fl E
fbcb50
@@ -103,18 +92,9 @@
fbcb50
 .It Fl K
fbcb50
 Specifies no automatic login to the remote system.
fbcb50
 .It Fl L
fbcb50
-Specifies an 8-bit data path on output.  This causes the
fbcb50
-BINARY option to be negotiated on output.
fbcb50
-.It Fl S Ar tos
fbcb50
-Sets the IP type-of-service (TOS) option for the telnet
fbcb50
-connection to the value
fbcb50
-.Ar tos ,
fbcb50
-which can be a numeric TOS value
fbcb50
-or, on systems that support it, a symbolic
fbcb50
-TOS name found in the
fbcb50
-.Pa /etc/iptos
fbcb50
-file.
fbcb50
-.It Fl X Ar atype 
fbcb50
+Specifies an 8-bit data path on output.
fbcb50
+This causes the BINARY option to be negotiated on output.
fbcb50
+.It Fl X Ar atype
fbcb50
 Disables the
fbcb50
 .Ar atype
fbcb50
 type of authentication.
fbcb50
@@ -144,7 +124,8 @@
fbcb50
 .It Fl c
fbcb50
 Disables the reading of the user's
fbcb50
 .Pa \&.telnetrc
fbcb50
-file.  (See the
fbcb50
+file.
fbcb50
+(See the
fbcb50
 .Ic toggle skiprc
fbcb50
 command on this man page.)
fbcb50
 .It Fl d
fbcb50
@@ -152,7 +133,7 @@
fbcb50
 .Ic debug
fbcb50
 toggle to
fbcb50
 .Dv TRUE .
fbcb50
-.It Fl e Ar escapechar 
fbcb50
+.It Fl e Ar escapechar
fbcb50
 Sets the initial
fbcb50
 .Nm
fbcb50
 escape character to
fbcb50
@@ -169,14 +150,14 @@
fbcb50
 If Kerberos authentication is being used, the
fbcb50
 .Fl k
fbcb50
 option requests that
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 obtain tickets for the remote host in
fbcb50
 realm
fbcb50
 .Ar realm
fbcb50
 instead of the remote host's realm, as determined
fbcb50
 by
fbcb50
 .Xr krb_realmofhost 3 .
fbcb50
-.It Fl l Ar user 
fbcb50
+.It Fl l Ar user
fbcb50
 When connecting to the remote system, if the remote system
fbcb50
 understands the
fbcb50
 .Ev ENVIRON
fbcb50
@@ -189,7 +170,7 @@
fbcb50
 This option may also be used with the
fbcb50
 .Ic open
fbcb50
 command.
fbcb50
-.It Fl n Ar tracefile 
fbcb50
+.It Fl n Ar tracefile
fbcb50
 Opens
fbcb50
 .Ar tracefile
fbcb50
 for recording trace information.
fbcb50
@@ -210,35 +191,38 @@
fbcb50
 Indicates the official name, an alias, or the Internet address
fbcb50
 of a remote host.
fbcb50
 .It Ar port
fbcb50
-Indicates a port number (address of an application).  If a number is
fbcb50
-not specified, the default
fbcb50
-.Nm telnet
fbcb50
+Indicates a port number (address of an application).
fbcb50
+If a number is not specified, the default
fbcb50
+.Nm
fbcb50
 port is used.
fbcb50
 .El
fbcb50
 .Pp
fbcb50
-When in rlogin mode, a line of the form ~.  disconnects from the
fbcb50
+When in rlogin mode, a line of the form ~.
fbcb50
+disconnects from the
fbcb50
 remote host; ~ is the telnet escape character.
fbcb50
 Similarly, the line ~^Z suspends the telnet session.
fbcb50
 The line ~^] escapes to the normal telnet escape prompt.
fbcb50
 .Pp
fbcb50
 Once a connection has been opened,
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 will attempt to enable the
fbcb50
 .Dv TELNET LINEMODE
fbcb50
 option.
fbcb50
 If this fails,
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 will revert to one of two input modes:
fbcb50
 either ``character at a time''
fbcb50
 or ``old line by line''
fbcb50
 depending on what the remote system supports.
fbcb50
 .Pp
fbcb50
-When 
fbcb50
+When
fbcb50
 .Dv LINEMODE
fbcb50
 is enabled, character processing is done on the
fbcb50
-local system, under the control of the remote system.  When input
fbcb50
+local system, under the control of the remote system.
fbcb50
+When input
fbcb50
 editing or character echoing is to be disabled, the remote system
fbcb50
-will relay that information.  The remote system will also relay
fbcb50
+will relay that information.
fbcb50
+The remote system will also relay
fbcb50
 changes to any special characters that happen on the remote
fbcb50
 system, so that they can take effect on the local system.
fbcb50
 .Pp
fbcb50
@@ -252,7 +236,7 @@
fbcb50
 (this would mostly be used to enter passwords
fbcb50
 without the password being echoed).
fbcb50
 .Pp
fbcb50
-If the 
fbcb50
+If the
fbcb50
 .Dv LINEMODE
fbcb50
 option is enabled, or if the
fbcb50
 .Ic localchars
fbcb50
@@ -267,7 +251,7 @@
fbcb50
 characters are trapped locally, and sent as
fbcb50
 .Tn TELNET
fbcb50
 protocol sequences to the remote side.
fbcb50
-If 
fbcb50
+If
fbcb50
 .Dv LINEMODE
fbcb50
 has ever been enabled, then the user's
fbcb50
 .Ic susp
fbcb50
@@ -278,9 +262,9 @@
fbcb50
 protocol sequences,
fbcb50
 and
fbcb50
 .Ic quit
fbcb50
-is sent as a 
fbcb50
+is sent as a
fbcb50
 .Dv TELNET ABORT
fbcb50
-instead of 
fbcb50
+instead of
fbcb50
 .Dv BREAK .
fbcb50
 There are options (see
fbcb50
 .Ic toggle
fbcb50
@@ -296,17 +280,26 @@
fbcb50
 (in the case of
fbcb50
 .Ic quit
fbcb50
 and
fbcb50
-.Ic intr  ) .
fbcb50
+.Ic intr ) .
fbcb50
 .Pp
fbcb50
 While connected to a remote host,
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 command mode may be entered by typing the
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 ``escape character'' (initially ``^]'').
fbcb50
 When in command mode, the normal terminal editing conventions are available.
fbcb50
+Note that the escape character will return to the command mode of the initial
fbcb50
+invocation of
fbcb50
+.Nm
fbcb50
+that has the controlling terminal.
fbcb50
+Use the
fbcb50
+.Cm send escape
fbcb50
+command to switch to command mode in subsequent
fbcb50
+.Nm
fbcb50
+processes on remote hosts.
fbcb50
 .Pp
fbcb50
 The following
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 commands are available.
fbcb50
 Only enough of each command to uniquely identify it need be typed
fbcb50
 (this is also true for arguments to the
fbcb50
@@ -320,26 +313,28 @@
fbcb50
 .Ic display
fbcb50
 commands).
fbcb50
 .Bl -tag -width "mode type"
fbcb50
-.It Ic auth Ar argument Op Ar ... 
fbcb50
+.It Ic auth Ar argument Op Ar ...
fbcb50
 The
fbcb50
 .Ic auth
fbcb50
 command manipulates the information sent through the
fbcb50
 .Dv TELNET AUTHENTICATE
fbcb50
-option.  Valid arguments for the
fbcb50
-auth command are as follows:
fbcb50
+option.
fbcb50
+Valid arguments for the
fbcb50
+.Ic auth
fbcb50
+command are as follows:
fbcb50
 .Bl -tag -width "disable type"
fbcb50
 .It Ic disable Ar type
fbcb50
 Disables the specified
fbcb50
 .Ar type
fbcb50
-of authentication.  To
fbcb50
-obtain a list of available types, use the
fbcb50
+of authentication.
fbcb50
+To obtain a list of available types, use the
fbcb50
 .Ic auth disable \&?
fbcb50
 command.
fbcb50
 .It Ic enable Ar type
fbcb50
 Enables the specified
fbcb50
 .Ar type
fbcb50
-of authentication.  To
fbcb50
-obtain a list of available types, use the
fbcb50
+of authentication.
fbcb50
+To obtain a list of available types, use the
fbcb50
 .Ic auth enable \&?
fbcb50
 command.
fbcb50
 .It Ic status
fbcb50
@@ -350,7 +345,7 @@
fbcb50
 Close a
fbcb50
 .Tn TELNET
fbcb50
 session and return to command mode.
fbcb50
-.It Ic display Ar argument Op Ar ... 
fbcb50
+.It Ic display Ar argument Op Ar ...
fbcb50
 Displays all, or some, of the
fbcb50
 .Ic set
fbcb50
 and
fbcb50
@@ -368,26 +363,27 @@
fbcb50
 .It Ic disable Ar type Ic [input|output]
fbcb50
 Disables the specified
fbcb50
 .Ar type
fbcb50
-of encryption.  If you
fbcb50
-omit
fbcb50
+of encryption.
fbcb50
+If you omit
fbcb50
 .Ic input
fbcb50
 and
fbcb50
 .Ic output ,
fbcb50
 both input and output
fbcb50
-are disabled.  To obtain a list of available
fbcb50
-types, use the
fbcb50
+are disabled.
fbcb50
+To obtain a list of available types, use the
fbcb50
 .Ic encrypt disable \&?
fbcb50
 command.
fbcb50
 .It Ic enable Ar type Ic [input|output]
fbcb50
 Enables the specified
fbcb50
 .Ar type
fbcb50
-of encryption.  If you
fbcb50
-omit
fbcb50
+of encryption.
fbcb50
+If you omit
fbcb50
 .Ic input
fbcb50
 and
fbcb50
 .Ic output ,
fbcb50
 both input and output are
fbcb50
-enabled.  To obtain a list of available types, use the
fbcb50
+enabled.
fbcb50
+To obtain a list of available types, use the
fbcb50
 .Ic encrypt enable \&?
fbcb50
 command.
fbcb50
 .It Ic input
fbcb50
@@ -407,18 +403,20 @@
fbcb50
 .Ic encrypt stop output
fbcb50
 command.
fbcb50
 .It Ic start Ic [input|output]
fbcb50
-Attempts to start encryption.  If you omit
fbcb50
+Attempts to start encryption.
fbcb50
+If you omit
fbcb50
 .Ic input
fbcb50
 and
fbcb50
-.Ic output,
fbcb50
-both input and output are enabled.  To
fbcb50
-obtain a list of available types, use the
fbcb50
+.Ic output ,
fbcb50
+both input and output are enabled.
fbcb50
+To obtain a list of available types, use the
fbcb50
 .Ic encrypt enable \&?
fbcb50
 command.
fbcb50
 .It Ic status
fbcb50
 Lists the current status of encryption.
fbcb50
 .It Ic stop Ic [input|output]
fbcb50
-Stops encryption.  If you omit
fbcb50
+Stops encryption.
fbcb50
+If you omit
fbcb50
 .Ic input
fbcb50
 and
fbcb50
 .Ic output ,
fbcb50
@@ -431,7 +429,7 @@
fbcb50
 .Ic encrypt stop
fbcb50
 commands.
fbcb50
 .El
fbcb50
-.It Ic environ Ar arguments Op Ar ... 
fbcb50
+.It Ic environ Ar arguments Op Ar ...
fbcb50
 The
fbcb50
 .Ic environ
fbcb50
 command is used to manipulate the
fbcb50
@@ -456,7 +454,7 @@
fbcb50
 .Ic environ
fbcb50
 command are:
fbcb50
 .Bl -tag -width Fl
fbcb50
-.It Ic define Ar variable value 
fbcb50
+.It Ic define Ar variable value
fbcb50
 Define the variable
fbcb50
 .Ar variable
fbcb50
 to have a value of
fbcb50
@@ -466,15 +464,15 @@
fbcb50
 .Ar value
fbcb50
 may be enclosed in single or double quotes so
fbcb50
 that tabs and spaces may be included.
fbcb50
-.It Ic undefine Ar variable 
fbcb50
+.It Ic undefine Ar variable
fbcb50
 Remove
fbcb50
 .Ar variable
fbcb50
 from the list of environment variables.
fbcb50
-.It Ic export Ar variable 
fbcb50
+.It Ic export Ar variable
fbcb50
 Mark the variable
fbcb50
 .Ar variable
fbcb50
 to be exported to the remote side.
fbcb50
-.It Ic unexport Ar variable 
fbcb50
+.It Ic unexport Ar variable
fbcb50
 Mark the variable
fbcb50
 .Ar variable
fbcb50
 to not be exported unless
fbcb50
@@ -508,7 +506,7 @@
fbcb50
 suspending a user's session for later reattachment,
fbcb50
 the logout argument indicates that you
fbcb50
 should terminate the session immediately.
fbcb50
-.It Ic mode Ar type 
fbcb50
+.It Ic mode Ar type
fbcb50
 .Ar type
fbcb50
 is one of several options, depending on the state of the
fbcb50
 .Tn TELNET
fbcb50
@@ -529,40 +527,40 @@
fbcb50
 option, or, if the remote side does not understand the
fbcb50
 .Dv LINEMODE
fbcb50
 option, then attempt to enter ``old-line-by-line'' mode.
fbcb50
-.It Ic isig Pq Ic \-isig 
fbcb50
-Attempt to enable (disable) the 
fbcb50
+.It Ic isig Pq Ic \-isig
fbcb50
+Attempt to enable (disable) the
fbcb50
 .Dv TRAPSIG
fbcb50
-mode of the 
fbcb50
+mode of the
fbcb50
 .Dv LINEMODE
fbcb50
 option.
fbcb50
-This requires that the 
fbcb50
+This requires that the
fbcb50
 .Dv LINEMODE
fbcb50
 option be enabled.
fbcb50
-.It Ic edit Pq Ic \-edit 
fbcb50
-Attempt to enable (disable) the 
fbcb50
+.It Ic edit Pq Ic \-edit
fbcb50
+Attempt to enable (disable) the
fbcb50
 .Dv EDIT
fbcb50
-mode of the 
fbcb50
+mode of the
fbcb50
 .Dv LINEMODE
fbcb50
 option.
fbcb50
-This requires that the 
fbcb50
+This requires that the
fbcb50
 .Dv LINEMODE
fbcb50
 option be enabled.
fbcb50
-.It Ic softtabs Pq Ic \-softtabs 
fbcb50
-Attempt to enable (disable) the 
fbcb50
+.It Ic softtabs Pq Ic \-softtabs
fbcb50
+Attempt to enable (disable) the
fbcb50
 .Dv SOFT_TAB
fbcb50
-mode of the 
fbcb50
+mode of the
fbcb50
 .Dv LINEMODE
fbcb50
 option.
fbcb50
-This requires that the 
fbcb50
+This requires that the
fbcb50
 .Dv LINEMODE
fbcb50
 option be enabled.
fbcb50
-.It Ic litecho Pq Ic \-litecho 
fbcb50
-Attempt to enable (disable) the 
fbcb50
+.It Ic litecho Pq Ic \-litecho
fbcb50
+Attempt to enable (disable) the
fbcb50
 .Dv LIT_ECHO
fbcb50
-mode of the 
fbcb50
+mode of the
fbcb50
 .Dv LINEMODE
fbcb50
 option.
fbcb50
-This requires that the 
fbcb50
+This requires that the
fbcb50
 .Dv LINEMODE
fbcb50
 option be enabled.
fbcb50
 .It Ic \&?
fbcb50
@@ -579,7 +577,7 @@
fbcb50
 Open a connection to the named host.
fbcb50
 If no port number
fbcb50
 is specified,
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 will attempt to contact a
fbcb50
 .Tn TELNET
fbcb50
 server at the default port.
fbcb50
@@ -594,24 +592,29 @@
fbcb50
 .Ev ENVIRON
fbcb50
 option.
fbcb50
 When connecting to a non-standard port,
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 omits any automatic initiation of
fbcb50
 .Tn TELNET
fbcb50
-options.  When the port number is preceded by a minus sign,
fbcb50
+options.
fbcb50
+When the port number is preceded by a minus sign,
fbcb50
 the initial option negotiation is done.
fbcb50
 After establishing a connection, the file
fbcb50
 .Pa \&.telnetrc
fbcb50
 in the
fbcb50
-user's home directory is opened.  Lines beginning with a ``#'' are
fbcb50
-comment lines.  Blank lines are ignored.  Lines that begin
fbcb50
-without white space are the start of a machine entry.  The
fbcb50
-first thing on the line is the name of the machine that is
fbcb50
-being connected to.  The rest of the line, and successive
fbcb50
-lines that begin with white space are assumed to be
fbcb50
-.Nm telnet
fbcb50
+user's home directory is opened.
fbcb50
+Lines beginning with a ``#'' are
fbcb50
+comment lines.
fbcb50
+Blank lines are ignored.
fbcb50
+Lines that begin
fbcb50
+without whitespace are the start of a machine entry.
fbcb50
+The first thing on the line is the name of the machine that is
fbcb50
+being connected to.
fbcb50
+The rest of the line, and successive
fbcb50
+lines that begin with whitespace are assumed to be
fbcb50
+.Nm
fbcb50
 commands and are processed as if they had been typed
fbcb50
 in manually to the
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 command prompt.
fbcb50
 .It Ic quit
fbcb50
 Close any open
fbcb50
@@ -619,7 +622,7 @@
fbcb50
 session and exit
fbcb50
 .Nm telnet .
fbcb50
 An end-of-file (in command mode) will also close a session and exit.
fbcb50
-.It Ic send Ar arguments 
fbcb50
+.It Ic send Ar arguments
fbcb50
 Sends one or more special character sequences to the remote host.
fbcb50
 The following are the arguments which may be specified
fbcb50
 (more than one argument may be specified at a time):
fbcb50
@@ -673,7 +676,7 @@
fbcb50
 sequence.
fbcb50
 .It Ic escape
fbcb50
 Sends the current
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 escape character (initially ``^]'').
fbcb50
 .It Ic ga
fbcb50
 Sends the
fbcb50
@@ -788,12 +791,12 @@
fbcb50
 .Ic send
fbcb50
 command.
fbcb50
 .El
fbcb50
-.It Ic set Ar argument value 
fbcb50
-.It Ic unset Ar argument value 
fbcb50
+.It Ic set Ar argument value
fbcb50
+.It Ic unset Ar argument value
fbcb50
 The
fbcb50
 .Ic set
fbcb50
 command will set any one of a number of
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 variables to a specific value or to
fbcb50
 .Dv TRUE .
fbcb50
 The special value
fbcb50
@@ -811,7 +814,8 @@
fbcb50
 .Ic display
fbcb50
 command.
fbcb50
 The variables which may be set or unset, but not toggled, are
fbcb50
-listed here.  In addition, any of the variables for the
fbcb50
+listed here.
fbcb50
+In addition, any of the variables for the
fbcb50
 .Ic toggle
fbcb50
 command may be explicitly set or unset using
fbcb50
 the
fbcb50
@@ -832,7 +836,8 @@
fbcb50
 sequence (see
fbcb50
 .Ic send ayt
fbcb50
 preceding) is sent to the
fbcb50
-remote host.  The initial value for the "Are You There"
fbcb50
+remote host.
fbcb50
+The initial value for the "Are You There"
fbcb50
 character is the terminal's status character.
fbcb50
 .It Ic echo
fbcb50
 This is the value (initially ``^E'') which, when in
fbcb50
@@ -841,7 +846,7 @@
fbcb50
 echoing of entered characters (for entering, say, a password).
fbcb50
 .It Ic eof
fbcb50
 If
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is operating in
fbcb50
 .Dv LINEMODE
fbcb50
 or ``old line by line'' mode, entering this character
fbcb50
@@ -854,7 +859,7 @@
fbcb50
 character.
fbcb50
 .It Ic erase
fbcb50
 If
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is in
fbcb50
 .Ic localchars
fbcb50
 mode (see
fbcb50
@@ -862,7 +867,7 @@
fbcb50
 .Ic localchars
fbcb50
 below),
fbcb50
 and if
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is operating in ``character at a time'' mode, then when this
fbcb50
 character is typed, a
fbcb50
 .Dv TELNET EC
fbcb50
@@ -879,14 +884,14 @@
fbcb50
 character.
fbcb50
 .It Ic escape
fbcb50
 This is the
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 escape character (initially ``^['') which causes entry
fbcb50
 into
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 command mode (when connected to a remote system).
fbcb50
 .It Ic flushoutput
fbcb50
 If
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is in
fbcb50
 .Ic localchars
fbcb50
 mode (see
fbcb50
@@ -916,12 +921,13 @@
fbcb50
 .Dv LINEMODE ,
fbcb50
 these are the
fbcb50
 characters that, when typed, cause partial lines to be
fbcb50
-forwarded to the remote system.  The initial value for
fbcb50
+forwarded to the remote system.
fbcb50
+The initial value for
fbcb50
 the forwarding characters are taken from the terminal's
fbcb50
 eol and eol2 characters.
fbcb50
 .It Ic interrupt
fbcb50
 If
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is in
fbcb50
 .Ic localchars
fbcb50
 mode (see
fbcb50
@@ -945,7 +951,7 @@
fbcb50
 character.
fbcb50
 .It Ic kill
fbcb50
 If
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is in
fbcb50
 .Ic localchars
fbcb50
 mode (see
fbcb50
@@ -953,7 +959,7 @@
fbcb50
 .Ic localchars
fbcb50
 below),
fbcb50
 and if
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is operating in ``character at a time'' mode, then when this
fbcb50
 character is typed, a
fbcb50
 .Dv TELNET EL
fbcb50
@@ -970,7 +976,7 @@
fbcb50
 character.
fbcb50
 .It Ic lnext
fbcb50
 If
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is operating in
fbcb50
 .Dv LINEMODE
fbcb50
 or ``old line by line'' mode, then this character is taken to
fbcb50
@@ -985,7 +991,7 @@
fbcb50
 character.
fbcb50
 .It Ic quit
fbcb50
 If
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is in
fbcb50
 .Ic localchars
fbcb50
 mode (see
fbcb50
@@ -1009,7 +1015,7 @@
fbcb50
 character.
fbcb50
 .It Ic reprint
fbcb50
 If
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is operating in
fbcb50
 .Dv LINEMODE
fbcb50
 or old line by line'' mode, then this character is taken to
fbcb50
@@ -1031,8 +1037,9 @@
fbcb50
 This character, at the beginning of a line, followed by
fbcb50
 a "." closes the connection; when followed by a ^Z it
fbcb50
 suspends the
fbcb50
-.Nm telnet
fbcb50
-command.  The initial state is to
fbcb50
+.Nm
fbcb50
+command.
fbcb50
+The initial state is to
fbcb50
 disable the
fbcb50
 .Ic rlogin
fbcb50
 escape character.
fbcb50
@@ -1066,7 +1073,7 @@
fbcb50
 character.
fbcb50
 .It Ic susp
fbcb50
 If
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is in
fbcb50
 .Ic localchars
fbcb50
 mode, or
fbcb50
@@ -1093,12 +1100,13 @@
fbcb50
 .Ic option
fbcb50
 tracing being
fbcb50
 .Dv TRUE ,
fbcb50
-will be written.  If it is set to
fbcb50
+will be written.
fbcb50
+If it is set to
fbcb50
 .Dq Fl ,
fbcb50
 then tracing information will be written to standard output (the default).
fbcb50
 .It Ic worderase
fbcb50
 If
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 is operating in
fbcb50
 .Dv LINEMODE
fbcb50
 or ``old line by line'' mode, then this character is taken to
fbcb50
@@ -1117,25 +1125,32 @@
fbcb50
 .Pq Ic unset
fbcb50
 commands.
fbcb50
 .El
fbcb50
-.It Ic slc Ar state 
fbcb50
+.It Ic skey Ar sequence challenge
fbcb50
+The
fbcb50
+.Ic skey
fbcb50
+command computes a response to the S/Key challenge.
fbcb50
+See
fbcb50
+.Xr skey 1
fbcb50
+for more information on the S/Key system.
fbcb50
+.It Ic slc Ar state
fbcb50
 The
fbcb50
 .Ic slc
fbcb50
 command (Set Local Characters) is used to set
fbcb50
 or change the state of the special
fbcb50
-characters when the 
fbcb50
+characters when the
fbcb50
 .Dv TELNET LINEMODE
fbcb50
 option has
fbcb50
-been enabled.  Special characters are characters that get
fbcb50
-mapped to 
fbcb50
+been enabled.
fbcb50
+Special characters are characters that get mapped to
fbcb50
 .Tn TELNET
fbcb50
 commands sequences (like
fbcb50
 .Ic ip
fbcb50
 or
fbcb50
-.Ic quit  )
fbcb50
+.Ic quit )
fbcb50
 or line editing characters (like
fbcb50
 .Ic erase
fbcb50
 and
fbcb50
-.Ic kill  ) .
fbcb50
+.Ic kill ) .
fbcb50
 By default, the local special characters are exported.
fbcb50
 .Bl -tag -width Fl
fbcb50
 .It Ic check
fbcb50
@@ -1144,15 +1159,15 @@
fbcb50
 character settings, and if there are any discrepancies with
fbcb50
 the local side, the local side will switch to the remote value.
fbcb50
 .It Ic export
fbcb50
-Switch to the local defaults for the special characters.  The
fbcb50
-local default characters are those of the local terminal at
fbcb50
+Switch to the local defaults for the special characters.
fbcb50
+The local default characters are those of the local terminal at
fbcb50
 the time when
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 was started.
fbcb50
 .It Ic import
fbcb50
 Switch to the remote defaults for the special characters.
fbcb50
 The remote default characters are those of the remote system
fbcb50
-at the time when the 
fbcb50
+at the time when the
fbcb50
 .Tn TELNET
fbcb50
 connection was established.
fbcb50
 .It Ic \&?
fbcb50
@@ -1165,13 +1180,13 @@
fbcb50
 .Nm telnet .
fbcb50
 This includes the peer one is connected to, as well
fbcb50
 as the current mode.
fbcb50
-.It Ic toggle Ar arguments Op Ar ... 
fbcb50
+.It Ic toggle Ar arguments Op Ar ...
fbcb50
 Toggle (between
fbcb50
 .Dv TRUE
fbcb50
 and
fbcb50
 .Dv FALSE )
fbcb50
 various flags that control how
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 responds to events.
fbcb50
 These flags may be set explicitly to
fbcb50
 .Dv TRUE
fbcb50
@@ -1206,7 +1221,7 @@
fbcb50
 sequences; see
fbcb50
 .Ic set
fbcb50
 above for details),
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 refuses to display any data on the user's terminal
fbcb50
 until the remote system acknowledges (via a
fbcb50
 .Dv TELNET TIMING MARK
fbcb50
@@ -1220,13 +1235,14 @@
fbcb50
 done an "stty noflsh", otherwise
fbcb50
 .Dv FALSE
fbcb50
 (see
fbcb50
-.Xr stty  1  ) .
fbcb50
+.Xr stty 1 ) .
fbcb50
 .It Ic autodecrypt
fbcb50
 When the
fbcb50
 .Dv TELNET ENCRYPT
fbcb50
 option is negotiated, by
fbcb50
 default the actual encryption (decryption) of the data
fbcb50
-stream does not start automatically.  The
fbcb50
+stream does not start automatically.
fbcb50
+The
fbcb50
 .Ic autoencrypt
fbcb50
 .Pq Ic autodecrypt
fbcb50
 command states that encryption of the
fbcb50
@@ -1238,7 +1254,8 @@
fbcb50
 .Dv TELNET AUTHENTICATION
fbcb50
 option
fbcb50
 .Tn TELNET
fbcb50
-attempts to use it to perform automatic authentication.  If the
fbcb50
+attempts to use it to perform automatic authentication.
fbcb50
+If the
fbcb50
 .Dv AUTHENTICATION
fbcb50
 option is not supported, the user's login
fbcb50
 name are propagated through the
fbcb50
@@ -1314,7 +1331,7 @@
fbcb50
 The initial value for this toggle is
fbcb50
 .Dv FALSE .
fbcb50
 .It Ic debug
fbcb50
-Toggles socket level debugging (useful only to the super-user).
fbcb50
+Toggles socket level debugging (useful only to the superuser).
fbcb50
 The initial value for this toggle is
fbcb50
 .Dv FALSE .
fbcb50
 .It Ic encdebug
fbcb50
@@ -1340,7 +1357,7 @@
fbcb50
 .Ic brk ,
fbcb50
 .Ic ec ,
fbcb50
 and
fbcb50
-.Ic el  ;
fbcb50
+.Ic el ;
fbcb50
 see
fbcb50
 .Ic send
fbcb50
 above).
fbcb50
@@ -1379,7 +1396,7 @@
fbcb50
 .Dv FALSE .
fbcb50
 .It Ic options
fbcb50
 Toggles the display of some internal
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 protocol processing (having to do with
fbcb50
 .Tn TELNET
fbcb50
 options).
fbcb50
@@ -1404,8 +1421,8 @@
fbcb50
 skips the reading of the
fbcb50
 .Pa \&.telnetrc
fbcb50
 file in the user's home
fbcb50
-directory when connections are opened.  The initial
fbcb50
-value for this toggle is
fbcb50
+directory when connections are opened.
fbcb50
+The initial value for this toggle is
fbcb50
 .Dv FALSE .
fbcb50
 .It Ic termdata
fbcb50
 Toggles the display of all terminal data (in hexadecimal format).
fbcb50
@@ -1416,9 +1433,10 @@
fbcb50
 .Ic verbose_encrypt
fbcb50
 toggle is
fbcb50
 .Dv TRUE ,
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 prints out a message each time encryption is enabled or
fbcb50
-disabled.  The initial value for this toggle is
fbcb50
+disabled.
fbcb50
+The initial value for this toggle is
fbcb50
 .Dv FALSE .
fbcb50
 .It Ic \&?
fbcb50
 Displays the legal
fbcb50
@@ -1430,22 +1448,24 @@
fbcb50
 .Nm telnet .
fbcb50
 This command only works when the user is using the
fbcb50
 .Xr csh 1 .
fbcb50
-.It Ic \&! Op Ar command 
fbcb50
+.It Ic \&! Op Ar command
fbcb50
 Execute a single command in a subshell on the local
fbcb50
-system.  If
fbcb50
+system.
fbcb50
+If
fbcb50
 .Ar command
fbcb50
 is omitted, then an interactive
fbcb50
 subshell is invoked.
fbcb50
-.It Ic \&? Op Ar command 
fbcb50
-Get help.  With no arguments,
fbcb50
-.Nm telnet
fbcb50
+.It Ic \&? Op Ar command
fbcb50
+Get help.
fbcb50
+With no arguments,
fbcb50
+.Nm
fbcb50
 prints a help summary.
fbcb50
 If a command is specified,
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 will print the help information for just that command.
fbcb50
 .El
fbcb50
 .Sh ENVIRONMENT
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 uses at least the
fbcb50
 .Ev HOME ,
fbcb50
 .Ev SHELL ,
fbcb50
@@ -1464,16 +1484,18 @@
fbcb50
 .El
fbcb50
 .Sh HISTORY
fbcb50
 The
fbcb50
-.Nm telnet
fbcb50
+.Nm
fbcb50
 command appeared in
fbcb50
 .Bx 4.2 .
fbcb50
 .Sh NOTES
fbcb50
 On some remote systems, echo has to be turned off manually when in
fbcb50
 ``old line by line'' mode.
fbcb50
 .Pp
fbcb50
-In ``old line by line'' mode or 
fbcb50
+In ``old line by line'' mode or
fbcb50
 .Dv LINEMODE
fbcb50
 the terminal's
fbcb50
 .Ic eof
fbcb50
 character is only recognized (and sent to the remote system)
fbcb50
 when it is the first character on a line.
fbcb50
+.Pp
fbcb50
+Source routing is not supported yet for IPv6.