diff options
| author | manuel <manuel@mausz.at> | 2013-02-04 00:08:53 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2013-02-04 00:08:53 +0100 |
| commit | 69aec538b456402170dc723af417ba5c05389c32 (patch) | |
| tree | e6f34c543f17c6392447ea337b2e2868212424d1 /dnsfq.c | |
| download | qmail-69aec538b456402170dc723af417ba5c05389c32.tar.gz qmail-69aec538b456402170dc723af417ba5c05389c32.tar.bz2 qmail-69aec538b456402170dc723af417ba5c05389c32.zip | |
qmail 1.03 import
Diffstat (limited to 'dnsfq.c')
| -rw-r--r-- | dnsfq.c | 32 |
1 files changed, 32 insertions, 0 deletions
| @@ -0,0 +1,32 @@ | |||
| 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 | } | ||
