diff options
Diffstat (limited to 'src/net/dns.c')
| -rw-r--r-- | src/net/dns.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/net/dns.c b/src/net/dns.c new file mode 100644 index 0000000..a8e5030 --- /dev/null +++ b/src/net/dns.c @@ -0,0 +1,19 @@ + +#include <netdb.h> +#include <string.h> + +#include "main.h" + +char* getIPFormDNS(char *domain) +{ + struct hostent *host; + + host = gethostbyname(domain); + + if( host == NULL || host->h_addr_list[0] == NULL ) + { + return NULL; + } + + return strdup( inet_ntoa( * ( (struct in_addr *) host->h_addr_list[0] ) ) ); +} |