riscv32: add dlsym
[musl.git] / src / network / res_query.c
blob506dc231266d9e0795140782c05b8c91368f7ecb
1 #define _BSD_SOURCE
2 #include <resolv.h>
3 #include <netdb.h>
5 int res_query(const char *name, int class, int type, unsigned char *dest, int len)
7 unsigned char q[280];
8 int ql = __res_mkquery(0, name, class, type, 0, 0, 0, q, sizeof q);
9 if (ql < 0) return ql;
10 int r = __res_send(q, ql, dest, len);
11 if (r<12) {
12 h_errno = TRY_AGAIN;
13 return -1;
15 if ((dest[3] & 15) == 3) {
16 h_errno = HOST_NOT_FOUND;
17 return -1;
19 if ((dest[3] & 15) == 0 && !dest[6] && !dest[7]) {
20 h_errno = NO_DATA;
21 return -1;
23 return r;
26 weak_alias(res_query, res_search);