1#include "locale_impl.h"
2#include <netdb.h>
3
4static const char msgs[] = "Invalid flags\0"
5                           "Name does not resolve\0"
6                           "Try again\0"
7                           "Non-recoverable error\0"
8                           "Unknown error\0"
9                           "Unrecognized address family or invalid length\0"
10                           "Unrecognized socket type\0"
11                           "Unrecognized service\0"
12                           "Unknown error\0"
13                           "Out of memory\0"
14                           "System error\0"
15                           "Overflow\0"
16                           "\0Unknown error";
17
18const char* gai_strerror(int ecode) {
19    const char* s;
20    for (s = msgs, ecode++; ecode && *s; ecode++, s++)
21        for (; *s; s++)
22            ;
23    if (!*s)
24        s++;
25    return LCTRANS_CUR(s);
26}
27