2 * Copyright (C) 2004, 2006 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.3 2006/08/25 05:25:50 marka Exp $ */
22 #include <lwres/netdb.h>
24 static const char *gai_messages[] = {
26 "address family for hostname not supported",
27 "temporary failure in name resolution",
28 "invalid value for ai_flags",
29 "non-recoverable failure in name resolution",
30 "ai_family not supported",
31 "memory allocation failure",
32 "no address associated with hostname",
33 "hostname nor servname provided, or not known",
34 "servname not supported for ai_socktype",
35 "ai_socktype not supported",
36 "system error returned in errno",
42 lwres_gai_strerror(int ecode) {
44 const char *const_ptr;
49 (ecode >= (int)(sizeof(gai_messages)/sizeof(*gai_messages))))
50 ptr.const_ptr = "invalid error code";
52 ptr.const_ptr = gai_messages[ecode];
53 return (ptr.deconst_ptr);