X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/f555c163f90c9de17ebcef8313f86404c5174ca9..6111d166dc39d14b67bb12d768d8f99d5d1bbcb2:/print-decnet.c diff --git a/print-decnet.c b/print-decnet.c index 6188bf75..da5a0ca1 100644 --- a/print-decnet.c +++ b/print-decnet.c @@ -21,31 +21,25 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.26 1999-10-07 23:47:11 mcr Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.36 2002-09-05 21:25:39 guy Exp $ (LBL)"; #endif -#include -#include -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include -#if __STDC__ struct mbuf; struct rtentry; -#endif -#include -#ifdef HAVE_LIBDNET +#ifdef HAVE_NETDNET_DNETDB_H #include #endif -#include -#ifdef HAVE_MALLOC_H -#include -#endif #include #include #include -#include #include "decnet.h" #include "extract.h" @@ -65,7 +59,7 @@ static void print_reason(int); static void pdata(u_char *, int); #endif -#ifdef HAVE_LIBDNET +#ifndef HAVE_NETDNET_DNETDB_H_DNET_HTOA extern char *dnet_htoa(struct dn_naddr *); #endif @@ -346,13 +340,13 @@ print_i_info(int info) } static void -print_elist(const char *elp, u_int len) +print_elist(const char *elp _U_, u_int len _U_) { /* Not enough examples available for me to debug this */ } static void -print_nsp(const u_char *nspp, u_int nsplen) +print_nsp(const u_char *nspp, u_int nsplen _U_) { const struct nsphdr *nsphp = (struct nsphdr *)nspp; int dst, src, flags; @@ -732,29 +726,30 @@ print_reason(register int reason) printf("%s ", tok2str(reason2str, "reason-%d", reason)); } -char * +const char * dnnum_string(u_short dnaddr) { char *str; + size_t siz; int area = (u_short)(dnaddr & AREAMASK) >> AREASHIFT; int node = dnaddr & NODEMASK; - str = (char *)malloc(sizeof("00.0000")); + str = (char *)malloc(siz = sizeof("00.0000")); if (str == NULL) error("dnnum_string: malloc"); - sprintf(str, "%d.%d", area, node); + snprintf(str, siz, "%d.%d", area, node); return(str); } -char * +const char * dnname_string(u_short dnaddr) { -#ifdef HAVE_LIBDNET +#ifdef HAVE_DNET_HTOA struct dn_naddr dna; dna.a_len = sizeof(short); memcpy((char *)dna.a_addr, (char *)&dnaddr, sizeof(short)); - return (savestr(dnet_htoa(&dna))); + return (strdup(dnet_htoa(&dna))); #else return(dnnum_string(dnaddr)); /* punt */ #endif @@ -769,10 +764,7 @@ pdata(u_char *dp, u_int maxlen) while (x-- > 0) { c = *dp++; - if (isprint(c)) - putchar(c); - else - printf("\\%o", c & 0xFF); + safeputchar(c); } } #endif