aboutsummaryrefslogtreecommitdiff
path: root/src/libndb/testdns.c
blob: 6c72c5d86fb95ba0de361327439366d16c90c83b (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
35
#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);
}