Blame SOURCES/telnet-client-cvs.patch

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