]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-domain.c
Add SunATM support, based on code from Yen Yen Lim at North Dakota State
[tcpdump] / print-domain.c
index c0a4be5bf5d6512136af08fcbfbe60911ce08e2d..b8ff06b8129ba5c2881e536f12a208f44adfa974 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.75 2001-02-23 08:55:21 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.78 2001-10-19 09:00:48 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -33,12 +33,6 @@ static const char rcsid[] =
 
 #include <netinet/in.h>
 
-#ifdef NOERROR
-#undef NOERROR                                 /* Solaris sucks */
-#endif
-#ifdef NOERROR
-#undef T_UNSPEC                                        /* SINIX does too */
-#endif
 #include "nameser.h"
 
 #include <stdio.h>
@@ -48,13 +42,13 @@ static const char rcsid[] =
 #include "addrtoname.h"
 #include "extract.h"                    /* must come after interface.h */
 
-static char *ns_ops[] = {
+static const char *ns_ops[] = {
        "", " inv_q", " stat", " op3", " notify", " update", " op6", " op7",
        " op8", " updataA", " updateD", " updateDA",
        " updateM", " updateMA", " zoneInit", " zoneRef",
 };
 
-static char *ns_resp[] = {
+static const char *ns_resp[] = {
        "", " FormErr", " ServFail", " NXDomain",
        " NotImp", " Refused", " YXDomain", " YXRRSet",
        " NXRRSet", " NotAuth", " NotZone", " Resp11",
@@ -514,7 +508,7 @@ ns_print(register const u_char *bp, u_int length)
 {
        register const HEADER *np;
        register int qdcount, ancount, nscount, arcount;
-       register const u_char *cp = NULL;
+       register const u_char *cp;
 
        np = (const HEADER *)bp;
        TCHECK(*np);
@@ -544,12 +538,10 @@ ns_print(register const u_char *bp, u_int length)
                                putchar(',');
                        if (vflag > 1) {
                                fputs(" q:", stdout);
-                               if ((cp = ns_qprint((const u_char *)(np + 1), bp))
-                                   == NULL)
+                               if ((cp = ns_qprint(cp, bp)) == NULL)
                                        goto trunc;
                        } else {
-                               if ((cp = ns_nskip((const u_char *)(np + 1), bp))
-                                   == NULL)
+                               if ((cp = ns_nskip(cp, bp)) == NULL)
                                        goto trunc;
                                cp += 4;        /* skip QTYPE and QCLASS */
                        }
@@ -621,9 +613,9 @@ ns_print(register const u_char *bp, u_int length)
                if (arcount)
                        printf(" [%dau]", arcount);
 
+               cp = (const u_char *)(np + 1);
                if (qdcount--) {
-                       cp = ns_qprint((const u_char *)(np + 1),
-                                      (const u_char *)np);
+                       cp = ns_qprint(cp, (const u_char *)np);
                        if (!cp)
                                goto trunc;
                        while (cp < snapend && qdcount--) {