prog.c: In function 'get_system_ns':
prog.c:4:15: error: 'NULL' undeclared (first use in this function)
char *buf = NULL;
^
prog.c:4:15: note: each undeclared identifier is reported only once for each function it appears in
prog.c:5:14: error: 'INET_ADDRSTRLEN' undeclared (first use in this function)
char addr[INET_ADDRSTRLEN] = { 0 };
^
prog.c:8:9: warning: implicit declaration of function 'res_init' [-Wimplicit-function-declaration]
ret = res_init();
^
prog.c:11:5: warning: implicit declaration of function 'debug' [-Wimplicit-function-declaration]
debug("Can't initialize resolver");
^
prog.c:14:11: warning: implicit declaration of function 'calloc' [-Wimplicit-function-declaration]
buf = calloc(INET_ADDRSTRLEN * MAXNS, sizeof(char));
^
prog.c:14:11: warning: incompatible implicit declaration of built-in function 'calloc'
prog.c:14:11: note: include '<stdlib.h>' or provide a declaration of 'calloc'
prog.c:14:36: error: 'MAXNS' undeclared (first use in this function)
buf = calloc(INET_ADDRSTRLEN * MAXNS, sizeof(char));
^
prog.c:23:25: warning: implicit declaration of function 'inet_ntop' [-Wimplicit-function-declaration]
const char *s = inet_ntop(AF_INET,
^
prog.c:23:35: error: 'AF_INET' undeclared (first use in this function)
const char *s = inet_ntop(AF_INET,
^
prog.c:24:36: error: '_res' undeclared (first use in this function)
&_res.nsaddr_list[i].sin_addr,
^
prog.c:28:67: warning: implicit declaration of function 'strerror' [-Wimplicit-function-declaration]
debug("Can't get address of nameserver #%d: %s", i + 1, strerror(errno));
^
prog.c:28:76: error: 'errno' undeclared (first use in this function)
debug("Can't get address of nameserver #%d: %s", i + 1, strerror(errno));
^
prog.c:35:13: warning: implicit declaration of function 'strcat' [-Wimplicit-function-declaration]
strcat(buf, ","); // Prepend next address by comma first
^
prog.c:35:13: warning: incompatible implicit declaration of built-in function 'strcat'
prog.c:35:13: note: include '<string.h>' or provide a declaration of 'strcat'
prog.c:38:11: warning: incompatible implicit declaration of built-in function 'strcat'
strcat(buf, addr);
^
prog.c:38:11: note: include '<string.h>' or provide a declaration of 'strcat'
prog.c:43:20: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
*ns = calloc(strlen(buf) + 1, sizeof(char));
^
prog.c:43:20: warning: incompatible implicit declaration of built-in function 'strlen'
prog.c:43:20: note: include '<string.h>' or provide a declaration of 'strlen'
prog.c:48:9: warning: implicit declaration of function 'strcpy' [-Wimplicit-function-declaration]
strcpy(*ns, buf);
^
prog.c:48:9: warning: incompatible implicit declaration of built-in function 'strcpy'
prog.c:48:9: note: include '<string.h>' or provide a declaration of 'strcpy'
prog.c:53:7: warning: implicit declaration of function 'free' [-Wimplicit-function-declaration]
free(buf);
^
prog.c:53:7: warning: incompatible implicit declaration of built-in function 'free'
prog.c:53:7: note: include '<stdlib.h>' or provide a declaration of 'free'
prog.c:5:9: warning: unused variable 'addr' [-Wunused-variable]
char addr[INET_ADDRSTRLEN] = { 0 };
^