diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-10-26 16:44:17 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-10-26 16:44:17 (GMT) |
commit | 79d64f400391ce81b4eda73977cb40099256b348 (patch) | |
tree | 47afaed270cf59335dbaf4eb7965eac64a02a687 /xpa/dns.c | |
parent | 1377ae8b2142276c24d28d65865e459038984c62 (diff) | |
download | blt-79d64f400391ce81b4eda73977cb40099256b348.zip blt-79d64f400391ce81b4eda73977cb40099256b348.tar.gz blt-79d64f400391ce81b4eda73977cb40099256b348.tar.bz2 |
upgrade XPA
Diffstat (limited to 'xpa/dns.c')
-rw-r--r-- | xpa/dns.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/xpa/dns.c b/xpa/dns.c deleted file mode 100644 index 32e33b1..0000000 --- a/xpa/dns.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory - */ - -#include <unistd.h> -#include <strings.h> -#include <stdio.h> -#include <netdb.h> /* gethostbyname() */ - -#define SZ_LINE 1024 - -int main(int argc, char **argv) -{ - int i; - char host[SZ_LINE]; - struct hostent *hostent; - - if( argc > 1 ) - strcpy(host, argv[1]); - else{ - fprintf(stderr, "calling gethostname() ...\n"); - if( gethostname(host, SZ_LINE) == -1 ){ - perror("gethostname"); - exit(1); - } - else{ - fprintf(stderr, "host name is %s\n", host); - } - } - fprintf(stderr, "calling gethostbyname(host) ...\n"); - if( !(hostent = gethostbyname(host)) ){ - perror("gethostbyname"); - exit(1); - } - else{ - fprintf(stderr, "gethostbyname() succeeded\n"); - } - fprintf(stderr, "printing ip address(es) for this host ...\n"); - if( hostent ){ - for(i=0; hostent->h_addr_list[i]; i++){ - fprintf(stderr, "%x\n", *(int *)hostent->h_addr_list[i]); - } - } - else{ - fprintf(stderr, "ERROR: can't look up: %s\n", host); - } - return(0); -} |