nightmaremail

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

dnsfq.c (599B)


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