aboutsummaryrefslogtreecommitdiff
path: root/src/libndb/testdns.c
blob: 96cbec57cef8c95f10eedfa6e5adc7977784c271 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <ndb.h>

void
main(int argc, char **argv)
{
	Ndbtuple *t, *t0;

	ARGBEGIN{
	default:
		goto usage;
	}ARGEND

	if(argc != 2){
	usage:
		fprint(2, "usage: testdns name val\n");
		exits("usage");
	}

	quotefmtinstall();
	if((t = dnsquery(nil, argv[0], argv[1])) == nil)
		sysfatal("dnsquery: %r");

	for(t0=t; t; t=t->entry){
		print("%s=%q ", t->attr, t->val);
		if(t->line == t0){
			print("\n");
			t0 = t->entry;
		}
	}
	exits(0);
}