forked from unpbook/unpv13e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gai_strerror.c
26 lines (24 loc) · 963 Bytes
/
gai_strerror.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
* Return a string containing some additional information after an
* error from getaddrinfo().
*/
#include <sys/types.h>
#include "addrinfo.h" /* XXX should be <netdb.h> */
char *
gai_strerror(int err)
{
switch (err) {
case EAI_ADDRFAMILY:return("address family for host not supported");
case EAI_AGAIN: return("temporary failure in name resolution");
case EAI_BADFLAGS: return("invalid flags value");
case EAI_FAIL: return("non-recoverable failure in name resolution");
case EAI_FAMILY: return("address family not supported");
case EAI_MEMORY: return("memory allocation failure");
case EAI_NODATA: return("no address associated with host");
case EAI_NONAME: return("host nor service provided, or not known");
case EAI_SERVICE: return("service not supported for socket type");
case EAI_SOCKTYPE: return("socket type not supported");
case EAI_SYSTEM: return("system error");
default: return("unknown getaddrinfo() error");
}
}