Upstream qmail 1.01
[qmail] / dnsip.c
CommitLineData
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
10char temp[IPFMT];
11
12stralloc sa = {0};
13ipalloc ia = {0};
14
15void main(argc,argv)
16int argc;
17char **argv;
18{
19 int j;
20
21 if (!argv[1]) _exit(100);
22
23 if (!stralloc_copys(&sa,argv[1]))
24 { substdio_putsflush(subfderr,"out of memory\n"); _exit(111); }
25
26 dns_init(0);
27 dnsdoe(dns_ip(&ia,&sa));
28 for (j = 0;j < ia.len;++j)
29 {
30 substdio_put(subfdout,temp,ip_fmt(temp,&ia.ix[j].ip));
31 substdio_putsflush(subfdout,"\n");
32 }
33 _exit(0);
34}