Blame SOURCES/telnet-client-cvs.patch

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