diff options
author | Henryk Plötz <henryk@ploetzli.ch> | 2014-10-03 20:04:14 +0200 |
---|---|---|
committer | Henryk Plötz <henryk@ploetzli.ch> | 2014-10-03 20:04:14 +0200 |
commit | c44d8b51ffb5a413f8bbdbd9991bbc573853e397 (patch) | |
tree | e7f2e644de620879f610c909c405cbc4e44d6062 /dnsip6q.c | |
parent | 0e5b2871ca6456b01d4bf037a6e68badf1ff1a41 (diff) | |
download | tinydnssec-c44d8b51ffb5a413f8bbdbd9991bbc573853e397.tar.gz tinydnssec-c44d8b51ffb5a413f8bbdbd9991bbc573853e397.tar.bz2 |
Apply patch djbdns-1.05-test27.diff.bz2
Source was http://www.fefe.de/dns/djbdns-1.05-test27.diff.bz2, SHA1 f0380ec1866f49c0bcf6369a923ac0a4a5095da8
Diffstat (limited to 'dnsip6q.c')
-rw-r--r-- | dnsip6q.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/dnsip6q.c b/dnsip6q.c new file mode 100644 index 0000000..82ab04e --- /dev/null +++ b/dnsip6q.c @@ -0,0 +1,43 @@ +#include "buffer.h" +#include "exit.h" +#include "strerr.h" +#include "ip6.h" +#include "dns.h" + +#define FATAL "dnsipq: fatal: " + +static char seed[128]; + +static stralloc in; +static stralloc fqdn; +static stralloc out; +char str[IP6_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_ip6_qualify(&out,&fqdn,&in) == -1) + strerr_die4sys(111,FATAL,"unable to find IP6 address for ",*argv,": "); + + buffer_put(buffer_1,fqdn.s,fqdn.len); + buffer_puts(buffer_1," "); + for (i = 0;i + 16 <= out.len;i += 16) { + buffer_put(buffer_1,str,ip6_fmt(str,out.s + i)); + buffer_puts(buffer_1," "); + } + buffer_puts(buffer_1,"\n"); + + ++argv; + } + + buffer_flush(buffer_1); + _exit(0); +} |