From 8bddb73c66e763b4776233dd96a8b05dc011b4ae Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 24 Jan 2000 01:16:43 +0000 Subject: [PATCH] Add support for differing gethostbyaddr(), sethostent() and endhostent(). --- lib/lwres/gethost.c | 30 ++++++++++++++++++++++++++++++ lib/lwres/include/lwres/netdb.h.in | 15 +++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/lib/lwres/gethost.c b/lib/lwres/gethost.c index f80f33624e..e84ac6ecee 100644 --- a/lib/lwres/gethost.c +++ b/lib/lwres/gethost.c @@ -16,6 +16,19 @@ gethostbyname(const char *name) { return (he); } +#ifdef ISC_LWRES_GETHOSTBYADDRVOID +struct hostent * +gethostbyaddr(const void *addr, int len, int type) { + int error; + + if (he != NULL) + freehostent(he); + + he = getipnodebyaddr(addr, len, type, &error); + h_errno = error; + return (he); +} +#else struct hostent * gethostbyaddr(const char *addr, int len, int type) { int error; @@ -27,6 +40,7 @@ gethostbyaddr(const char *addr, int len, int type) { h_errno = error; return (he); } +#endif struct hostent * gethostent(void) { @@ -37,12 +51,28 @@ gethostent(void) { return (NULL); } +#ifdef ISC_LWRES_SETHOSTENTINT +int +sethostent(int stayopen) { + (void)stayopen; + return (0); +} +#else void sethostent(int stayopen) { /* empty */ + (void)stayopen; } +#endif +#ifdef ISC_LWRES_ENDHOSTENTINT +int +endhostent(void) { + return(0); +} +#else void endhostent(void) { /* empty */ } +#endif diff --git a/lib/lwres/include/lwres/netdb.h.in b/lib/lwres/include/lwres/netdb.h.in index 16df4a5cea..375c057d42 100644 --- a/lib/lwres/include/lwres/netdb.h.in +++ b/lib/lwres/include/lwres/netdb.h.in @@ -46,6 +46,21 @@ */ @ISC_LWRES_SETNETENTINT@ +/* + * Define if gethostbyaddr takes a void * as first arguement. + */ +@ISC_LWRES_GETHOSTBYADDRVOID@ + +/* + * Define if sethostent returns an int. + */ +@ISC_LWRES_SETHOSTENTINT@ + +/* + * Define if endhostent returns an int. + */ +@ISC_LWRES_ENDHOSTENTINT@ + #ifdef ISC_LWRES_NEEDADDRINFO struct addrinfo { int ai_flags; /* AI_PASSIVE, AI_CANONNAME */