#include #include #include int main(int c, char **v) { const char * addrAsText = c < 2 ? "pool.ntp.org" : v[1]; hostent *ret = gethostbyname(addrAsText); if (!ret) { herror("gethostbyname failed"); return 1; } for (int i = 0; ret->h_addr_list[i]; ++i) { in_addr *addrAsInt = (in_addr *)ret->h_addr_list[i]; puts(inet_ntoa(*addrAsInt)); } return 0; }