plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

testdns.c (493B)


      1 #include <u.h>
      2 #include <libc.h>
      3 #include <bio.h>
      4 #include <ndb.h>
      5 
      6 void
      7 main(int argc, char **argv)
      8 {
      9 	Ndbtuple *t, *t0;
     10 
     11 	ARGBEGIN{
     12 	default:
     13 		goto usage;
     14 	}ARGEND
     15 
     16 	if(argc != 2){
     17 	usage:
     18 		fprint(2, "usage: testdns name val\n");
     19 		exits("usage");
     20 	}
     21 
     22 	quotefmtinstall();
     23 	if((t = dnsquery(nil, argv[0], argv[1])) == nil)
     24 		sysfatal("dnsquery: %r");
     25 
     26 	for(t0=t; t; t=t->entry){
     27 		print("%s=%q ", t->attr, t->val);
     28 		if(t->line == t0){
     29 			print("\n");
     30 			t0 = t->entry;
     31 		}
     32 	}
     33 	exits(0);
     34 }