From d3bc29242e6dd87a400ed4b5628087d9c9ffb4c1 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 26 Mar 2005 23:07:50 +0000 Subject: If we have ether_hostton(), check whether we have 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). --- nametoaddr.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'nametoaddr.c') 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 */ -- cgit v1.2.3