Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/arp Get rid of the TRY_AGAIN kludge. It is complete...



details:   https://anonhg.NetBSD.org/src/rev/3a83f4360594
branches:  trunk
changeset: 501686:3a83f4360594
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 05 19:34:13 2001 +0000

description:
Get rid of the TRY_AGAIN kludge. It is completely counter intuitive to have
every DNS lookup fail after the first TRY_AGAIN failure.
Also take care of minor lint stuff [extra h_errno declaratation/NULL vs. 0 etc]

diffstat:

 usr.sbin/arp/arp.c |  20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diffs (62 lines):

diff -r 9e870784048a -r 3a83f4360594 usr.sbin/arp/arp.c
--- a/usr.sbin/arp/arp.c        Fri Jan 05 19:08:04 2001 +0000
+++ b/usr.sbin/arp/arp.c        Fri Jan 05 19:34:13 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arp.c,v 1.26 2000/10/11 20:23:48 is Exp $ */
+/*     $NetBSD: arp.c,v 1.27 2001/01/05 19:34:13 christos Exp $ */
 
 /*
  * Copyright (c) 1984, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)arp.c      8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: arp.c,v 1.26 2000/10/11 20:23:48 is Exp $");
+__RCSID("$NetBSD: arp.c,v 1.27 2001/01/05 19:34:13 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -99,6 +99,8 @@
 static int nflag, vflag;
 static int s = -1;
 
+extern char *__progname;
+
 int
 main(argc, argv)
        int argc;
@@ -387,7 +389,6 @@
        struct rt_msghdr *rtm;
        struct sockaddr_inarp *sin;
        struct sockaddr_dl *sdl;
-       extern int h_errno;
        struct hostent *hp;
 
        mib[0] = CTL_NET;
@@ -419,14 +420,10 @@
                        hp = gethostbyaddr((caddr_t)&(sin->sin_addr),
                            sizeof sin->sin_addr, AF_INET);
                else
-                       hp = 0;
-               if (hp)
-                       host = hp->h_name;
-               else {
-                       host = "?";
-                       if (h_errno == TRY_AGAIN)
-                               nflag = 1;
-               }
+                       hp = NULL;
+
+               host = hp ? hp->h_name : "?";
+
                (void)printf("%s (%s) at ", host, inet_ntoa(sin->sin_addr));
                if (sdl->sdl_alen)
                        sdl_print(sdl);
@@ -502,7 +499,6 @@
 void
 usage()
 {
-       extern char *__progname;
 
        (void)fprintf(stderr, "usage: %s [-n] hostname\n", __progname);
        (void)fprintf(stderr, "usage: %s [-n] -a\n", __progname);



Home | Main Index | Thread Index | Old Index