aboutsummaryrefslogtreecommitdiffstats
path: root/src/gethostbyname.c
diff options
context:
space:
mode:
authorEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-10-13 20:54:28 -0500
committerEpoch Qwert <epoch@53flpnlls43fcguy.onion>2014-10-13 20:54:28 -0500
commit1852f2d7d63c39d0fd97a2774d1bd16bf53ec67d (patch)
tree69bc1a71b839857e6b841862b74aa3c0b56b860c /src/gethostbyname.c
downloadmisc-1852f2d7d63c39d0fd97a2774d1bd16bf53ec67d.tar.gz
misc-1852f2d7d63c39d0fd97a2774d1bd16bf53ec67d.zip
initial commit. collected some tools I had laying around.
Diffstat (limited to 'src/gethostbyname.c')
-rw-r--r--src/gethostbyname.c16
1 files changed, 16 insertions, 0 deletions
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 <stdio.h>
+#include <netdb.h>
+
+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;
+}