Add -N option (numeric host address) - idea taken from FreeBSD.

Fix bug where -E8 would still pick up 0xFF as escape (again from FreeBSD)
This commit is contained in:
abs 1999-07-28 06:35:15 +00:00
parent fb4ecab492
commit 8714299f16
5 changed files with 26 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: commands.c,v 1.30 1999/07/21 13:24:56 jtk Exp $ */
/* $NetBSD: commands.c,v 1.31 1999/07/28 06:35:15 abs Exp $ */
/*
* Copyright (C) 1997 and 1998 WIDE Project.
@ -67,7 +67,7 @@
#if 0
static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
#else
__RCSID("$NetBSD: commands.c,v 1.30 1999/07/21 13:24:56 jtk Exp $");
__RCSID("$NetBSD: commands.c,v 1.31 1999/07/28 06:35:15 abs Exp $");
#endif
#endif /* not lint */
@ -2284,7 +2284,10 @@ tn(argc, argv)
/*numeric*/
freeaddrinfo(res0);
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
if (doaddrlookup)
hints.ai_flags = AI_CANONNAME;
else
hints.ai_flags |= AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: externs.h,v 1.14 1999/07/02 15:09:10 itojun Exp $ */
/* $NetBSD: externs.h,v 1.15 1999/07/28 06:35:15 abs Exp $ */
/*
* Copyright (c) 1988, 1990, 1993
@ -155,6 +155,7 @@ extern int
termdata, /* Print out terminal data flow */
#endif /* defined(unix) */
debug, /* Debug level */
doaddrlookup, /* do a reverse address lookup? */
clienteof; /* Client received EOF */
extern cc_t escape; /* Escape to command mode */

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.10 1999/07/11 19:30:39 thorpej Exp $ */
/* $NetBSD: main.c,v 1.11 1999/07/28 06:35:16 abs Exp $ */
/*
* Copyright (c) 1988, 1990, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1990, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 5/30/95";
#else
__RCSID("$NetBSD: main.c,v 1.10 1999/07/11 19:30:39 thorpej Exp $");
__RCSID("$NetBSD: main.c,v 1.11 1999/07/28 06:35:16 abs Exp $");
#endif
#endif /* not lint */
@ -95,10 +95,10 @@ usage()
fprintf(stderr, "Usage: %s %s%s%s%s\n",
prompt,
#ifdef AUTHENTICATION
"[-8] [-E] [-K] [-L] [-S tos] [-X atype] [-a] [-c] [-d] [-e char]",
"\n\t[-k realm] [-l user] [-f/-F] [-n tracefile] ",
"[-8] [-E] [-K] [-L] [-N] [-S tos] [-X atype] [-a] [-c] [-d]",
"\n\t[-e char] [-k realm] [-l user] [-f/-F] [-n tracefile] ",
#else
"[-8] [-E] [-L] [-S tos] [-a] [-c] [-d] [-e char] [-l user]",
"[-8] [-E] [-L] [-N] [-S tos] [-a] [-c] [-d] [-e char] [-l user]",
"\n\t[-n tracefile]",
#endif
#if defined(TN3270) && defined(unix)
@ -158,7 +158,7 @@ main(argc, argv)
#else
#define IPSECOPT
#endif
while ((ch = getopt(argc, argv, "8EKLS:X:acde:fFk:l:n:rt:x"
while ((ch = getopt(argc, argv, "8EKLNS:X:acde:fFk:l:n:rt:x"
IPSECOPT)) != -1) {
#undef IPSECOPT
switch(ch) {
@ -176,6 +176,9 @@ main(argc, argv)
case 'L':
eight |= 2; /* binary output only */
break;
case 'N':
doaddrlookup = 0;
break;
case 'S':
{
#ifdef HAS_GETTOS

View File

@ -1,4 +1,4 @@
.\" $NetBSD: telnet.1,v 1.12 1999/07/02 15:09:11 itojun Exp $
.\" $NetBSD: telnet.1,v 1.13 1999/07/28 06:35:16 abs Exp $
.\"
.\" Copyright (c) 1983, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -48,6 +48,7 @@ protocol
.Op Fl F
.Op Fl K
.Op Fl L
.Op Fl N
.Bk -words
.Op Fl S Ar tos
.Ek
@ -118,6 +119,9 @@ Specifies no automatic login to the remote system.
.It Fl L
Specifies an 8-bit data path on output. This causes the
BINARY option to be negotiated on output.
.It Fl N
Numeric host address. No attempt will be made to look up
symbolic names for host addresses.
.It Fl S Ar tos
Sets the IP type-of-service (TOS) option for the telnet
connection to the value

View File

@ -1,4 +1,4 @@
/* $NetBSD: telnet.c,v 1.12 1998/11/06 19:54:19 christos Exp $ */
/* $NetBSD: telnet.c,v 1.13 1999/07/28 06:35:16 abs Exp $ */
/*
* Copyright (c) 1988, 1990, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95";
#else
__RCSID("$NetBSD: telnet.c,v 1.12 1998/11/06 19:54:19 christos Exp $");
__RCSID("$NetBSD: telnet.c,v 1.13 1999/07/28 06:35:16 abs Exp $");
#endif
#endif /* not lint */
@ -113,6 +113,7 @@ int
donebinarytoggle, /* the user has put us in binary */
dontlecho, /* do we suppress local echoing right now? */
globalmode,
doaddrlookup = 1, /* do a reverse address lookup? */
clienteof = 0;
char *prompt = 0;
@ -2001,7 +2002,7 @@ telsnd()
}
if ((sc == '\n') || (sc == '\r'))
bol = 1;
} else if (sc == escape) {
} else if (sc == escape && escape != _POSIX_VDISABLE) {
/*
* Double escape is a pass through of a single escape character.
*/