|
Packit Service |
4684c1 |
/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2020 Free Software
|
|
Packit Service |
4684c1 |
Foundation, Inc.
|
|
Packit Service |
4684c1 |
This file is part of the GNU C Library.
|
|
Packit Service |
4684c1 |
Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
This program is free software; you can redistribute it and/or modify
|
|
Packit Service |
4684c1 |
it under the terms of the GNU General Public License as published by
|
|
Packit Service |
4684c1 |
the Free Software Foundation; either version 3, or (at your option)
|
|
Packit Service |
4684c1 |
any later version.
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
This program is distributed in the hope that it will be useful,
|
|
Packit Service |
4684c1 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
4684c1 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
4684c1 |
GNU General Public License for more details.
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
You should have received a copy of the GNU General Public License
|
|
Packit Service |
4684c1 |
along with this program; if not, see <https://www.gnu.org/licenses/>. */
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#ifndef _LIBC
|
|
Packit Service |
4684c1 |
# include <config.h>
|
|
Packit Service |
4684c1 |
#endif
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#include <stdio.h>
|
|
Packit Service |
4684c1 |
#include <netdb.h>
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#ifdef _LIBC
|
|
Packit Service |
4684c1 |
# include <libintl.h>
|
|
Packit Service |
4684c1 |
#else
|
|
Packit Service |
4684c1 |
# include "gettext.h"
|
|
Packit Service |
4684c1 |
# define _(String) gettext (String)
|
|
Packit Service |
4684c1 |
# define N_(String) String
|
|
Packit Service |
4684c1 |
#endif
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#if HAVE_DECL_GAI_STRERROR
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# include <sys/socket.h>
|
|
Packit Service |
4684c1 |
# undef gai_strerror
|
|
Packit Service |
4684c1 |
# if HAVE_DECL_GAI_STRERRORA
|
|
Packit Service |
4684c1 |
# define gai_strerror gai_strerrorA
|
|
Packit Service |
4684c1 |
# endif
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
const char *
|
|
Packit Service |
4684c1 |
rpl_gai_strerror (int code)
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
return gai_strerror (code);
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
#else /* !HAVE_DECL_GAI_STRERROR */
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
static struct
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
int code;
|
|
Packit Service |
4684c1 |
const char *msg;
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
values[] =
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
{ EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
|
|
Packit Service |
4684c1 |
{ EAI_AGAIN, N_("Temporary failure in name resolution") },
|
|
Packit Service |
4684c1 |
{ EAI_BADFLAGS, N_("Bad value for ai_flags") },
|
|
Packit Service |
4684c1 |
{ EAI_FAIL, N_("Non-recoverable failure in name resolution") },
|
|
Packit Service |
4684c1 |
{ EAI_FAMILY, N_("ai_family not supported") },
|
|
Packit Service |
4684c1 |
{ EAI_MEMORY, N_("Memory allocation failure") },
|
|
Packit Service |
4684c1 |
{ EAI_NODATA, N_("No address associated with hostname") },
|
|
Packit Service |
4684c1 |
{ EAI_NONAME, N_("Name or service not known") },
|
|
Packit Service |
4684c1 |
{ EAI_SERVICE, N_("Servname not supported for ai_socktype") },
|
|
Packit Service |
4684c1 |
{ EAI_SOCKTYPE, N_("ai_socktype not supported") },
|
|
Packit Service |
4684c1 |
{ EAI_SYSTEM, N_("System error") },
|
|
Packit Service |
4684c1 |
{ EAI_OVERFLOW, N_("Argument buffer too small") },
|
|
Packit Service |
4684c1 |
#ifdef EAI_INPROGRESS
|
|
Packit Service |
4684c1 |
{ EAI_INPROGRESS, N_("Processing request in progress") },
|
|
Packit Service |
4684c1 |
{ EAI_CANCELED, N_("Request canceled") },
|
|
Packit Service |
4684c1 |
{ EAI_NOTCANCELED, N_("Request not canceled") },
|
|
Packit Service |
4684c1 |
{ EAI_ALLDONE, N_("All requests done") },
|
|
Packit Service |
4684c1 |
{ EAI_INTR, N_("Interrupted by a signal") },
|
|
Packit Service |
4684c1 |
{ EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
|
|
Packit Service |
4684c1 |
#endif
|
|
Packit Service |
4684c1 |
};
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
const char *
|
|
Packit Service |
4684c1 |
gai_strerror (int code)
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
size_t i;
|
|
Packit Service |
4684c1 |
for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
|
|
Packit Service |
4684c1 |
if (values[i].code == code)
|
|
Packit Service |
4684c1 |
return _(values[i].msg);
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
return _("Unknown error");
|
|
Packit Service |
4684c1 |
}
|
|
Packit Service |
4684c1 |
# ifdef _LIBC
|
|
Packit Service |
4684c1 |
libc_hidden_def (gai_strerror)
|
|
Packit Service |
4684c1 |
# endif
|
|
Packit Service |
4684c1 |
#endif /* !HAVE_DECL_GAI_STRERROR */
|