hstrerror.c 361 B

123456789101112131415161718
  1. #define _GNU_SOURCE
  2. #include <netdb.h>
  3. #include "locale_impl.h"
  4. static const char msgs[] =
  5. "Host not found\0"
  6. "Try again\0"
  7. "Non-recoverable error\0"
  8. "Address not available\0"
  9. "\0Unknown error";
  10. const char *hstrerror(int ecode)
  11. {
  12. const char *s;
  13. for (s=msgs, ecode--; ecode && *s; ecode--, s++) for (; *s; s++);
  14. if (!*s) s++;
  15. return LCTRANS_CUR(s);
  16. }