]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-atalk.c
Add program_name field in the netdissect_options structure
[tcpdump] / print-atalk.c
index 09c0ff43b1e88d73722976c6af98de5826e7328c..a8ed07aeaacd26b8ca647b5cfe19958c3be2cc2c 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "addrtoname.h"
 #include "ethertype.h"
-#include "extract.h"                   /* must come after interface.h */
+#include "extract.h"
 #include "appletalk.h"
 
 static const char tstr[] = "[|atalk]";
@@ -566,10 +566,11 @@ ataddr_string(netdissect_options *ndo,
                             tp->nxt; tp = tp->nxt)
                                ;
                        tp->addr = i2;
-                       tp->nxt = newhnamemem();
+                       tp->nxt = newhnamemem(ndo);
                        tp->name = strdup(nambuf);
                        if (tp->name == NULL)
-                               error("ataddr_string: strdup(nambuf)");
+                               (*ndo->ndo_error)(ndo,
+                                                 "ataddr_string: strdup(nambuf)");
                }
                fclose(fp);
        }
@@ -583,24 +584,25 @@ ataddr_string(netdissect_options *ndo,
        for (tp2 = &hnametable[i & (HASHNAMESIZE-1)]; tp2->nxt; tp2 = tp2->nxt)
                if (tp2->addr == i) {
                        tp->addr = (atnet << 8) | athost;
-                       tp->nxt = newhnamemem();
+                       tp->nxt = newhnamemem(ndo);
                        (void)snprintf(nambuf, sizeof(nambuf), "%s.%d",
                            tp2->name, athost);
                        tp->name = strdup(nambuf);
                        if (tp->name == NULL)
-                               error("ataddr_string: strdup(nambuf)");
+                               (*ndo->ndo_error)(ndo,
+                                                 "ataddr_string: strdup(nambuf)");
                        return (tp->name);
                }
 
        tp->addr = (atnet << 8) | athost;
-       tp->nxt = newhnamemem();
+       tp->nxt = newhnamemem(ndo);
        if (athost != 255)
                (void)snprintf(nambuf, sizeof(nambuf), "%d.%d", atnet, athost);
        else
                (void)snprintf(nambuf, sizeof(nambuf), "%d", atnet);
        tp->name = strdup(nambuf);
        if (tp->name == NULL)
-               error("ataddr_string: strdup(nambuf)");
+               (*ndo->ndo_error)(ndo, "ataddr_string: strdup(nambuf)");
 
        return (tp->name);
 }