Commit | Line | Data |
---|---|---|
2117e02e MW |
1 | #include "substdio.h" |
2 | #include "subfd.h" | |
3 | #include "stralloc.h" | |
4 | #include "dns.h" | |
5 | #include "dnsdoe.h" | |
6 | #include "ip.h" | |
7 | #include "ipalloc.h" | |
8 | #include "exit.h" | |
9 | ||
10 | stralloc sa = {0}; | |
11 | ipalloc ia = {0}; | |
12 | ||
13 | void main(argc,argv) | |
14 | int argc; | |
15 | char **argv; | |
16 | { | |
17 | if (!argv[1]) _exit(100); | |
18 | ||
19 | if (!stralloc_copys(&sa,argv[1])) | |
20 | { substdio_putsflush(subfderr,"out of memory\n"); _exit(111); } | |
21 | ||
22 | dns_init(1); | |
23 | dnsdoe(dns_ip(&ia,&sa)); | |
24 | if (ia.len <= 0) | |
25 | { | |
26 | substdio_putsflush(subfderr,"no IP addresses\n"); _exit(100); | |
27 | } | |
28 | dnsdoe(dns_ptr(&sa,&ia.ix[0].ip)); | |
29 | substdio_putflush(subfdout,sa.s,sa.len); | |
30 | substdio_putsflush(subfdout,"\n"); | |
31 | _exit(0); | |
32 | } |