diff options
Diffstat (limited to 'lib/libc/net/gethostbyht.c')
-rw-r--r-- | lib/libc/net/gethostbyht.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/libc/net/gethostbyht.c b/lib/libc/net/gethostbyht.c index cd5f0f4..eeecd22 100644 --- a/lib/libc/net/gethostbyht.c +++ b/lib/libc/net/gethostbyht.c @@ -65,6 +65,8 @@ static char rcsid[] = "$FreeBSD$"; #include <ctype.h> #include <errno.h> #include <string.h> +#include <stdarg.h> +#include <nsswitch.h> #include <arpa/nameser.h> /* XXX */ #include <resolv.h> /* XXX */ @@ -163,13 +165,16 @@ gethostent() return (&host); } -struct hostent * -_gethostbyhtname(name, af) +int +_ht_gethostbyname(void *rval, void *cb_data, va_list ap) +{ const char *name; int af; -{ register struct hostent *p; register char **cp; + + name = va_arg(ap, const char *); + af = va_arg(ap, int); sethostent(0); while ((p = gethostent()) != NULL) { @@ -183,20 +188,28 @@ _gethostbyhtname(name, af) } found: endhostent(); - return (p); + *(struct hostent **)rval = p; + + return (p != NULL) ? NS_SUCCESS : NS_NOTFOUND; } -struct hostent * -_gethostbyhtaddr(addr, len, af) +int +_ht_gethostbyaddr(void *rval, void *cb_data, va_list ap) +{ const char *addr; int len, af; -{ register struct hostent *p; + addr = va_arg(ap, const char *); + len = va_arg(ap, int); + af = va_arg(ap, int); + sethostent(0); while ((p = gethostent()) != NULL) if (p->h_addrtype == af && !bcmp(p->h_addr, addr, len)) break; endhostent(); - return (p); + + *(struct hostent **)rval = p; + return (p != NULL) ? NS_SUCCESS : NS_NOTFOUND; } |