Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/telnet Add -N option (numeric host address) - idea t...



details:   https://anonhg.NetBSD.org/src/rev/6b19dc5f313e
branches:  trunk
changeset: 474978:6b19dc5f313e
user:      abs <abs%NetBSD.org@localhost>
date:      Wed Jul 28 06:35:15 1999 +0000

description:
Add -N option (numeric host address) - idea taken from FreeBSD.
Fix bug where -E8 would still pick up 0xFF as escape (again from FreeBSD)

diffstat:

 usr.bin/telnet/commands.c |   9 ++++++---
 usr.bin/telnet/externs.h  |   3 ++-
 usr.bin/telnet/main.c     |  15 +++++++++------
 usr.bin/telnet/telnet.1   |   6 +++++-
 usr.bin/telnet/telnet.c   |   7 ++++---
 5 files changed, 26 insertions(+), 14 deletions(-)

diffs (160 lines):

diff -r 8cb297d05f96 -r 6b19dc5f313e usr.bin/telnet/commands.c
--- a/usr.bin/telnet/commands.c Wed Jul 28 06:35:06 1999 +0000
+++ b/usr.bin/telnet/commands.c Wed Jul 28 06:35:15 1999 +0000
@@ -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 @@
        /*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;
diff -r 8cb297d05f96 -r 6b19dc5f313e usr.bin/telnet/externs.h
--- a/usr.bin/telnet/externs.h  Wed Jul 28 06:35:06 1999 +0000
+++ b/usr.bin/telnet/externs.h  Wed Jul 28 06:35:15 1999 +0000
@@ -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 @@
     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 */
diff -r 8cb297d05f96 -r 6b19dc5f313e usr.bin/telnet/main.c
--- a/usr.bin/telnet/main.c     Wed Jul 28 06:35:06 1999 +0000
+++ b/usr.bin/telnet/main.c     Wed Jul 28 06:35:15 1999 +0000
@@ -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 @@
 #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 @@
        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 @@
 #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 @@
                case 'L':
                        eight |= 2;     /* binary output only */
                        break;
+               case 'N':
+                       doaddrlookup = 0;
+                       break;
                case 'S':
                    {
 #ifdef HAS_GETTOS
diff -r 8cb297d05f96 -r 6b19dc5f313e usr.bin/telnet/telnet.1
--- a/usr.bin/telnet/telnet.1   Wed Jul 28 06:35:06 1999 +0000
+++ b/usr.bin/telnet/telnet.1   Wed Jul 28 06:35:15 1999 +0000
@@ -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 @@
 .Op Fl F
 .Op Fl K
 .Op Fl L
+.Op Fl N
 .Bk -words
 .Op Fl S Ar tos
 .Ek
@@ -118,6 +119,9 @@
 .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
diff -r 8cb297d05f96 -r 6b19dc5f313e usr.bin/telnet/telnet.c
--- a/usr.bin/telnet/telnet.c   Wed Jul 28 06:35:06 1999 +0000
+++ b/usr.bin/telnet/telnet.c   Wed Jul 28 06:35:15 1999 +0000
@@ -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 @@
        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 @@
                }
                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.
             */



Home | Main Index | Thread Index | Old Index