X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/8b8bd88793f2f52709056380e619e79ccf393cfd..ed5d57202ebab0e923eb8e9d967a9f97792a6e8f:/lib/libc/net/getnetbyht.c diff --git a/lib/libc/net/getnetbyht.c b/lib/libc/net/getnetbyht.c index c45d2a5baa..0e5f26e597 100644 --- a/lib/libc/net/getnetbyht.c +++ b/lib/libc/net/getnetbyht.c @@ -49,6 +49,8 @@ #include #include #include +#include +#include #define MAXALIASES 35 @@ -128,12 +130,15 @@ again: return (&net); } -struct netent * -_getnetbyhtname(const char *name) +int +_ht_getnetbyname(void *rval, void *cb_data, va_list ap) { + const char *name; struct netent *p; char **cp; + name = va_arg(ap, const char *); + setnetent(_net_stayopen); while ( (p = getnetent()) ) { if (strcasecmp(p->n_name, name) == 0) @@ -145,19 +150,26 @@ _getnetbyhtname(const char *name) found: if (!_net_stayopen) endnetent(); - return (p); + *(struct netent **)rval = p; + return (p != NULL) ? NS_SUCCESS : NS_NOTFOUND; } -struct netent * -_getnetbyhtaddr(unsigned long net, int type) +int +_ht_getnetbyaddr(void *rval, void *cb_data, va_list ap) { + unsigned long net; + int type; struct netent *p; + net = va_arg(ap, unsigned long); + type = va_arg(ap, int); + setnetent(_net_stayopen); while ( (p = getnetent()) ) if (p->n_addrtype == type && p->n_net == net) break; if (!_net_stayopen) endnetent(); - return (p); + *(struct netent **)rval = p; + return (p != NULL) ? NS_SUCCESS : NS_NOTFOUND; }