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