initial check-in, version 0.5.0
[musl] / src / network / res_query.c
1 #include <netdb.h>
2 #include "__dns.h"
3
4 int res_query(const char *name, int class, int type, unsigned char *dest, int len)
5 {
6         if (class != 1 || len < 512)
7                 return -1;
8         switch(__dns_doqueries(dest, name, &type, 1)) {
9         case EAI_NONAME:
10                 h_errno = HOST_NOT_FOUND;
11                 return -1;
12         case EAI_AGAIN:
13                 h_errno = TRY_AGAIN;
14                 return -1;
15         case EAI_FAIL:
16                 h_errno = NO_RECOVERY;
17                 return -1;
18         }
19         return 512;
20 }