2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2000, 2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: gai_strerror.c,v 1.14.2.1.10.1 2004/03/06 08:15:30 marka Exp $ */
20 #include <lwres/netdb.h>
22 static const char *gai_messages[] = {
24 "address family for hostname not supported",
25 "temporary failure in name resolution",
26 "invalid value for ai_flags",
27 "non-recoverable failure in name resolution",
28 "ai_family not supported",
29 "memory allocation failure",
30 "no address associated with hostname",
31 "hostname nor servname provided, or not known",
32 "servname not supported for ai_socktype",
33 "ai_socktype not supported",
34 "system error returned in errno",
40 lwres_gai_strerror(int ecode) {
42 const char *const_ptr;
47 (ecode >= (int)(sizeof(gai_messages)/sizeof(*gai_messages))))
48 ptr.const_ptr = "invalid error code";
50 ptr.const_ptr = gai_messages[ecode];
51 return (ptr.deconst_ptr);