Blame SOURCES/telnet-client-cvs.patch

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