summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/getaddrinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/net/getaddrinfo.c')
-rw-r--r--lib/libc/net/getaddrinfo.c111
1 files changed, 31 insertions, 80 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index 3db8cc82ee9..c7cc0500c33 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getaddrinfo.c,v 1.50 2004/06/07 21:11:23 marc Exp $ */
+/* $OpenBSD: getaddrinfo.c,v 1.51 2005/03/25 13:24:12 otto Exp $ */
/* $KAME: getaddrinfo.c,v 1.31 2000/08/31 17:36:43 itojun Exp $ */
/*
@@ -279,8 +279,7 @@ do { \
((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY)))
static int
-str2number(p)
- const char *p;
+str2number(const char *p)
{
char *ep;
unsigned long v;
@@ -297,10 +296,8 @@ str2number(p)
}
int
-getaddrinfo(hostname, servname, hints, res)
- const char *hostname, *servname;
- const struct addrinfo *hints;
- struct addrinfo **res;
+getaddrinfo(const char *hostname, const char *servname,
+ const struct addrinfo *hints, struct addrinfo **res)
{
struct addrinfo sentinel;
struct addrinfo *cur;
@@ -499,11 +496,8 @@ getaddrinfo(hostname, servname, hints, res)
*/
static int
-explore_fqdn(pai, hostname, servname, res)
- const struct addrinfo *pai;
- const char *hostname;
- const char *servname;
- struct addrinfo **res;
+explore_fqdn(const struct addrinfo *pai, const char *hostname,
+ const char *servname, struct addrinfo **res)
{
struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res);
struct addrinfo *result;
@@ -597,10 +591,8 @@ free:
* non-passive socket -> localhost (127.0.0.1 or ::1)
*/
static int
-explore_null(pai, servname, res)
- const struct addrinfo *pai;
- const char *servname;
- struct addrinfo **res;
+explore_null(const struct addrinfo *pai, const char *servname,
+ struct addrinfo **res)
{
int s;
const struct afd *afd;
@@ -661,12 +653,8 @@ free:
* numeric hostname
*/
static int
-explore_numeric(pai, hostname, servname, res, canonname)
- const struct addrinfo *pai;
- const char *hostname;
- const char *servname;
- struct addrinfo **res;
- const char *canonname;
+explore_numeric(const struct addrinfo *pai, const char *hostname,
+ const char *servname, struct addrinfo **res, const char *canonname)
{
const struct afd *afd;
struct addrinfo *cur;
@@ -747,11 +735,8 @@ bad:
* numeric hostname with scope
*/
static int
-explore_numeric_scope(pai, hostname, servname, res)
- const struct addrinfo *pai;
- const char *hostname;
- const char *servname;
- struct addrinfo **res;
+explore_numeric_scope(const struct addrinfo *pai, const char *hostname,
+ const char *servname, struct addrinfo **res)
{
#if !defined(SCOPE_DELIMITER) || !defined(INET6)
return explore_numeric(pai, hostname, servname, res, hostname);
@@ -813,10 +798,7 @@ explore_numeric_scope(pai, hostname, servname, res)
}
static int
-get_canonname(pai, ai, str)
- const struct addrinfo *pai;
- struct addrinfo *ai;
- const char *str;
+get_canonname(const struct addrinfo *pai, struct addrinfo *ai, const char *str)
{
if ((pai->ai_flags & AI_CANONNAME) != 0) {
ai->ai_canonname = strdup(str);
@@ -827,10 +809,7 @@ get_canonname(pai, ai, str)
}
static struct addrinfo *
-get_ai(pai, afd, addr)
- const struct addrinfo *pai;
- const struct afd *afd;
- const char *addr;
+get_ai(const struct addrinfo *pai, const struct afd *afd, const char *addr)
{
char *p;
struct addrinfo *ai;
@@ -852,9 +831,7 @@ get_ai(pai, afd, addr)
}
static int
-get_portmatch(ai, servname)
- const struct addrinfo *ai;
- const char *servname;
+get_portmatch(const struct addrinfo *ai, const char *servname)
{
/* get_port does not touch first argument. when matchonly == 1. */
@@ -863,10 +840,7 @@ get_portmatch(ai, servname)
}
static int
-get_port(ai, servname, matchonly)
- struct addrinfo *ai;
- const char *servname;
- int matchonly;
+get_port(struct addrinfo *ai, const char *servname, int matchonly)
{
const char *proto;
struct servent *sp;
@@ -951,8 +925,7 @@ get_port(ai, servname, matchonly)
}
static const struct afd *
-find_afd(af)
- int af;
+find_afd(int af)
{
const struct afd *afd;
@@ -968,10 +941,7 @@ find_afd(af)
#ifdef INET6
/* convert a string to a scope identifier. XXX: IPv6 specific */
static int
-ip6_str2scopeid(scope, sin6, scopeid)
- char *scope;
- struct sockaddr_in6 *sin6;
- u_int32_t *scopeid;
+ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6, u_int32_t *scopeid)
{
u_long lscopeid;
struct in6_addr *a6 = &sin6->sin6_addr;
@@ -1020,12 +990,8 @@ static const char AskedForGot[] =
static FILE *hostf = NULL;
static struct addrinfo *
-getanswer(answer, anslen, qname, qtype, pai)
- const querybuf *answer;
- int anslen;
- const char *qname;
- int qtype;
- const struct addrinfo *pai;
+getanswer(const querybuf *answer, int anslen, const char *qname, int qtype,
+ const struct addrinfo *pai)
{
struct addrinfo sentinel, *cur;
struct addrinfo ai;
@@ -1212,9 +1178,7 @@ getanswer(answer, anslen, qname, qtype, pai)
/*ARGSUSED*/
static struct addrinfo *
-_dns_getaddrinfo(name, pai)
- const char *name;
- const struct addrinfo *pai;
+_dns_getaddrinfo(const char *name, const struct addrinfo *pai)
{
struct addrinfo *ai;
querybuf *buf, *buf2;
@@ -1292,7 +1256,7 @@ _dns_getaddrinfo(name, pai)
static FILE *hostf;
static void
-_sethtent()
+_sethtent(void)
{
if (!hostf)
hostf = fopen(_PATH_HOSTS, "r" );
@@ -1301,7 +1265,7 @@ _sethtent()
}
static void
-_endhtent()
+_endhtent(void)
{
if (hostf) {
(void) fclose(hostf);
@@ -1310,9 +1274,7 @@ _endhtent()
}
static struct addrinfo *
-_gethtent(name, pai)
- const char *name;
- const struct addrinfo *pai;
+_gethtent(const char *name, const struct addrinfo *pai)
{
char *p;
char *cp, *tname, *cname;
@@ -1374,9 +1336,7 @@ found:
/*ARGSUSED*/
static struct addrinfo *
-_files_getaddrinfo(name, pai)
- const char *name;
- const struct addrinfo *pai;
+_files_getaddrinfo(const char *name, const struct addrinfo *pai)
{
struct addrinfo sentinel, *cur;
struct addrinfo *p;
@@ -1400,9 +1360,7 @@ static char *__ypdomain;
/*ARGSUSED*/
static struct addrinfo *
-_yphostent(line, pai)
- char *line;
- const struct addrinfo *pai;
+_yphostent(char *line, const struct addrinfo *pai)
{
struct addrinfo sentinel, *cur;
struct addrinfo hints, *res, *res0;
@@ -1478,9 +1436,7 @@ done:
/*ARGSUSED*/
static struct addrinfo *
-_yp_getaddrinfo(name, pai)
- const char *name;
- const struct addrinfo *pai;
+_yp_getaddrinfo(const char *name, const struct addrinfo *pai)
{
struct addrinfo sentinel, *cur;
struct addrinfo *ai = NULL;
@@ -1550,9 +1506,7 @@ extern int res_opt(int, u_char *, int, int);
* Caller must parse answer and determine whether it answers the question.
*/
static int
-res_queryN(name, target)
- const char *name; /* domain name */
- struct res_target *target;
+res_queryN(const char *name, struct res_target *target)
{
struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res);
u_char *buf;
@@ -1668,9 +1622,7 @@ res_queryN(name, target)
* is detected. Error code, if any, is left in h_errno.
*/
static int
-res_searchN(name, target)
- const char *name; /* domain name */
- struct res_target *target;
+res_searchN(const char *name, struct res_target *target)
{
struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res);
const char *cp, * const *domain;
@@ -1808,9 +1760,8 @@ res_searchN(name, target)
* removing a trailing dot from name if domain is NULL.
*/
static int
-res_querydomainN(name, domain, target)
- const char *name, *domain;
- struct res_target *target;
+res_querydomainN(const char *name, const char *domain,
+ struct res_target *target)
{
struct __res_state *_resp = _THREAD_PRIVATE(_res, _res, &_res);
char nbuf[MAXDNAME];