nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

dnsip.c (554B)


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