From 1852f2d7d63c39d0fd97a2774d1bd16bf53ec67d Mon Sep 17 00:00:00 2001 From: Epoch Qwert Date: Mon, 13 Oct 2014 20:54:28 -0500 Subject: initial commit. collected some tools I had laying around. --- src/gethostbyname.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/gethostbyname.c (limited to 'src/gethostbyname.c') diff --git a/src/gethostbyname.c b/src/gethostbyname.c new file mode 100644 index 0000000..646bf0a --- /dev/null +++ b/src/gethostbyname.c @@ -0,0 +1,16 @@ +#include +#include + +int main(int argc,char *argv[]) { + int i; + if(argc < 2) return 1; + struct hostent *he=gethostbyname(argv[1]); + for(i=0;he->h_addr_list[i];i++) { + printf("%u.%u.%u.%u\n", + (unsigned char)he->h_addr_list[i][0], + (unsigned char)he->h_addr_list[i][1], + (unsigned char)he->h_addr_list[i][2], + (unsigned char)he->h_addr_list[i][3]); + } + return 0; +} -- cgit v1.2.3