и опять проблема компилирования на Linux
bash$ gcc exp.c -o exp -lresolv
---------------------- exp.c ---------------
#include <stdio.h>
#include <string.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/nameser.h>
#include <resolv.h>
#define BUFLEN 1024
char queryname[BUFLEN];
char answer[BUFLEN];
int main(int arg, char *argv[])
{
ns_msg handle;
int anslen;
strcpy(queryname,argv[1]);
if (res_init() < 0)
{
fprintf(stderr,"Could not initialize resolver, exiting\n");
return 2;
}
if ((anslen = res_search(queryname,C_IN,T_A,answer,BUFLEN)) == -1)
{
herror("DNS query failed");
return 3;
}
ns_initparse(answer,anslen,&handle);
return 0;
}
--------------------------------------------