/lib/gai_strerror.c

https://github.com/sgrant24/Project4 · C · 78 lines · 53 code · 6 blank · 19 comment · 3 complexity · 079584a91a20ccd1a74effd1e1ff6462 MD5 · raw file

  1. /* -*- buffer-read-only: t -*- vi: set ro: */
  2. /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
  3. #line 1
  4. /* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
  5. This file is part of the GNU C Library.
  6. Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 3, or (at your option)
  10. any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. 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. */
  18. #ifndef _LIBC
  19. # include <config.h>
  20. #endif
  21. #include <stdio.h>
  22. #include <netdb.h>
  23. #ifdef _LIBC
  24. # include <libintl.h>
  25. #else
  26. # include "gettext.h"
  27. # define _(String) gettext (String)
  28. # define N_(String) String
  29. #endif
  30. static struct
  31. {
  32. int code;
  33. const char *msg;
  34. }
  35. values[] =
  36. {
  37. { EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
  38. { EAI_AGAIN, N_("Temporary failure in name resolution") },
  39. { EAI_BADFLAGS, N_("Bad value for ai_flags") },
  40. { EAI_FAIL, N_("Non-recoverable failure in name resolution") },
  41. { EAI_FAMILY, N_("ai_family not supported") },
  42. { EAI_MEMORY, N_("Memory allocation failure") },
  43. { EAI_NODATA, N_("No address associated with hostname") },
  44. { EAI_NONAME, N_("Name or service not known") },
  45. { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
  46. { EAI_SOCKTYPE, N_("ai_socktype not supported") },
  47. { EAI_SYSTEM, N_("System error") },
  48. { EAI_OVERFLOW, N_("Argument buffer too small") },
  49. #ifdef EAI_INPROGRESS
  50. { EAI_INPROGRESS, N_("Processing request in progress") },
  51. { EAI_CANCELED, N_("Request canceled") },
  52. { EAI_NOTCANCELED, N_("Request not canceled") },
  53. { EAI_ALLDONE, N_("All requests done") },
  54. { EAI_INTR, N_("Interrupted by a signal") },
  55. { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
  56. #endif
  57. };
  58. const char *
  59. gai_strerror (int code)
  60. {
  61. size_t i;
  62. for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
  63. if (values[i].code == code)
  64. return _(values[i].msg);
  65. return _("Unknown error");
  66. }
  67. #ifdef _LIBC
  68. libc_hidden_def (gai_strerror)
  69. #endif