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