Fix MAC password.
[gnutls.git] / gl / gai_strerror.c
blobafbcdbb4f7a78965d2114828ded3384201d08570
1 /* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 #ifndef _LIBC
20 # include <config.h>
21 #endif
23 #include <stdio.h>
24 #include <netdb.h>
26 #ifdef _LIBC
27 # include <libintl.h>
28 #else
29 # include "gettext.h"
30 # define _(String) gettext (String)
31 # define N_(String) String
32 #endif
34 static struct
36 int code;
37 const char *msg;
39 values[] =
41 { EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
42 { EAI_AGAIN, N_("Temporary failure in name resolution") },
43 { EAI_BADFLAGS, N_("Bad value for ai_flags") },
44 { EAI_FAIL, N_("Non-recoverable failure in name resolution") },
45 { EAI_FAMILY, N_("ai_family not supported") },
46 { EAI_MEMORY, N_("Memory allocation failure") },
47 { EAI_NODATA, N_("No address associated with hostname") },
48 { EAI_NONAME, N_("Name or service not known") },
49 { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
50 { EAI_SOCKTYPE, N_("ai_socktype not supported") },
51 { EAI_SYSTEM, N_("System error") },
52 { EAI_OVERFLOW, N_("Argument buffer too small") },
53 #ifdef EAI_INPROGRESS
54 { EAI_INPROGRESS, N_("Processing request in progress") },
55 { EAI_CANCELED, N_("Request canceled") },
56 { EAI_NOTCANCELED, N_("Request not canceled") },
57 { EAI_ALLDONE, N_("All requests done") },
58 { EAI_INTR, N_("Interrupted by a signal") },
59 { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
60 #endif
63 const char *
64 gai_strerror (int code)
66 size_t i;
67 for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
68 if (values[i].code == code)
69 return _(values[i].msg);
71 return _("Unknown error");
73 #ifdef _LIBC
74 libc_hidden_def (gai_strerror)
75 #endif