From 0e5b2871ca6456b01d4bf037a6e68badf1ff1a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henryk=20Pl=C3=B6tz?= Date: Fri, 3 Oct 2014 19:58:52 +0200 Subject: Initial commit of djbdns-1.05.tar.gz Source was http://cr.yp.to/djbdns/djbdns-1.05.tar.gz, SHA1 2efdb3a039d0c548f40936aa9cb30829e0ce8c3d --- dnsipq.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 dnsipq.c (limited to 'dnsipq.c') diff --git a/dnsipq.c b/dnsipq.c new file mode 100644 index 0000000..8e34928 --- /dev/null +++ b/dnsipq.c @@ -0,0 +1,43 @@ +#include "buffer.h" +#include "exit.h" +#include "strerr.h" +#include "ip4.h" +#include "dns.h" + +#define FATAL "dnsipq: fatal: " + +static char seed[128]; + +static stralloc in; +static stralloc fqdn; +static stralloc out; +char str[IP4_FMT]; + +int main(int argc,char **argv) +{ + int i; + + dns_random_init(seed); + + if (*argv) ++argv; + + while (*argv) { + if (!stralloc_copys(&in,*argv)) + strerr_die2x(111,FATAL,"out of memory"); + if (dns_ip4_qualify(&out,&fqdn,&in) == -1) + strerr_die4sys(111,FATAL,"unable to find IP address for ",*argv,": "); + + buffer_put(buffer_1,fqdn.s,fqdn.len); + buffer_puts(buffer_1," "); + for (i = 0;i + 4 <= out.len;i += 4) { + buffer_put(buffer_1,str,ip4_fmt(str,out.s + i)); + buffer_puts(buffer_1," "); + } + buffer_puts(buffer_1,"\n"); + + ++argv; + } + + buffer_flush(buffer_1); + _exit(0); +} -- cgit v1.2.3