aboutsummaryrefslogtreecommitdiff
path: root/src/libndb/testdns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libndb/testdns.c')
-rw-r--r--src/libndb/testdns.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/libndb/testdns.c b/src/libndb/testdns.c
new file mode 100644
index 00000000..6c72c5d8
--- /dev/null
+++ b/src/libndb/testdns.c
@@ -0,0 +1,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);
+}
+