X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=libc%2Finet%2Fgetaddrinfo.c;h=225bc75c69ebd8829f36fcae6dfc79d80904005d;hb=af0172162f7c653cad6a11ed1c1a5459bc154465;hp=553d5a944aa70375addc0480d5fd5259245eb177;hpb=22119008112a4abb723a48ea54b8c9626c449db9;p=uclinux-h8%2FuClibc.git diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index 553d5a944..225bc75c6 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -1,3 +1,10 @@ +/* + * Copyright 1996 by Craig Metz + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + /* $USAGI: getaddrinfo.c,v 1.16 2001/10/04 09:52:03 sekiya Exp $ */ /* The Inner Net License, Version 2.00 @@ -42,8 +49,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. If these license terms cause you a real problem, contact the author. */ -/* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */ - #define _GNU_SOURCE #define __FORCE_GLIBC #include @@ -63,6 +68,28 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +/* libc_hidden_proto(strcmp) */ +/* libc_hidden_proto(stpcpy) */ +libc_hidden_proto(strchr) +libc_hidden_proto(strcpy) +libc_hidden_proto(strlen) +libc_hidden_proto(socket) +libc_hidden_proto(close) +libc_hidden_proto(getservbyname_r) +libc_hidden_proto(gethostbyname_r) +libc_hidden_proto(gethostbyname2_r) +libc_hidden_proto(gethostbyaddr_r) +libc_hidden_proto(inet_pton) +libc_hidden_proto(inet_ntop) +libc_hidden_proto(strtoul) +libc_hidden_proto(if_nametoindex) +/* libc_hidden_proto(uname) */ +#ifdef __UCLIBC_HAS_IPV6__ +libc_hidden_proto(in6addr_loopback) +#endif + /* The following declarations and definitions have been removed from * the public header since we don't want people to use them. */ #define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */ @@ -240,7 +267,7 @@ gaih_local (const char *name, const struct gaih_service *service, sizeof (sunp->sun_path)) return GAIH_OKIFUNSPEC | -EAI_SERVICE; - __stpcpy (__stpcpy (sunp->sun_path, P_tmpdir "/"), service->name); + stpcpy (stpcpy (sunp->sun_path, P_tmpdir "/"), service->name); } } else @@ -583,10 +610,9 @@ gaih_inet (const char *name, const struct gaih_service *service, #if __UCLIBC_HAS_IPV6__ if (req->ai_family == 0 || req->ai_family == AF_INET6) { - extern const struct in6_addr __in6addr_loopback; at->family = AF_INET6; if ((req->ai_flags & AI_PASSIVE) == 0) - memcpy (at->addr, &__in6addr_loopback, sizeof (struct in6_addr)); + memcpy (at->addr, &in6addr_loopback, sizeof (struct in6_addr)); atr = at->next; } #endif @@ -759,6 +785,21 @@ static struct gaih gaih[] = { PF_UNSPEC, NULL } }; +void +freeaddrinfo (struct addrinfo *ai) +{ + struct addrinfo *p; + + while (ai != NULL) + { + p = ai; + ai = ai->ai_next; + free (p); + } +} +libc_hidden_proto(freeaddrinfo) +libc_hidden_def(freeaddrinfo) + int getaddrinfo (const char *name, const char *service, const struct addrinfo *hints, struct addrinfo **pai) @@ -858,16 +899,5 @@ getaddrinfo (const char *name, const char *service, return last_i ? -(last_i & GAIH_EAI) : EAI_NONAME; } - -void -freeaddrinfo (struct addrinfo *ai) -{ - struct addrinfo *p; - - while (ai != NULL) - { - p = ai; - ai = ai->ai_next; - free (p); - } -} +libc_hidden_proto(getaddrinfo) +libc_hidden_def(getaddrinfo)