aboutsummaryrefslogtreecommitdiffstats
path: root/nametoaddr.c
diff options
context:
space:
mode:
authorguy <guy>2005-03-26 23:07:50 +0000
committerguy <guy>2005-03-26 23:07:50 +0000
commitd3bc29242e6dd87a400ed4b5628087d9c9ffb4c1 (patch)
treed533bc89f0c4822c40daf48cdeb422edfc3bd760 /nametoaddr.c
parentafe114b0708f5986a90de7329360d3ec328b20a4 (diff)
If we have ether_hostton(), check whether we have <netinet/if_ether.h>
and if including it declares ether_hostton(), and define HAVE_DECL_ETHER_HOSTTON appropriately, and use that to determine whether to define it ourselves, rather than having a set of OSes that don't need it, as that set can change over time. Make the default declaration of "ether_hostton()" declare its first argument as "const char *", as that's what it's *supposed* to be (although it's not declared as such in some OSes, so we still have to cast a "const char *" when passed as the first argument).
Diffstat (limited to 'nametoaddr.c')
-rw-r--r--nametoaddr.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/nametoaddr.c b/nametoaddr.c
index b6c6a66..bffcf7e 100644
--- a/nametoaddr.c
+++ b/nametoaddr.c
@@ -24,7 +24,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.74 2005-03-17 07:02:32 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/nametoaddr.c,v 1.75 2005-03-26 23:07:51 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -405,18 +405,8 @@ pcap_ether_hostton(const char *name)
}
#else
-/*
- * XXX - perhaps this should, instead, be declared in "lbl/os-XXX.h" files,
- * for those OS versions that don't declare it, rather than being declared
- * here? That way, for example, we could declare it on FreeBSD 2.x (which
- * doesn't declare it), but not on FreeBSD 3.x (which declares it like
- * this) or FreeBSD 4.x (which declares it with its first argument as
- * "const char *", so no matter how we declare it here, it'll fail to
- * compile on one of 3.x or 4.x).
- */
-#if !defined(sgi) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \
- !defined(_UNICOSMP)
-extern int ether_hostton(char *, struct ether_addr *);
+#if !defined(HAVE_DECL_ETHER_HOSTTON) || !HAVE_DECL_ETHER_HOSTTON
+extern int ether_hostton(const char *, struct ether_addr *);
#endif
/* Use the os supplied routines */