Index: adns/Makefile.in
diff -u adns/Makefile.in:1.10 adns/Makefile.in:1.11
--- adns/Makefile.in:1.10	Thu May 20 00:29:37 1999
+++ adns/Makefile.in	Thu Jul 15 00:43:27 1999
@@ -16,7 +16,7 @@
 #  along with this program; if not, write to the Free Software Foundation,
 #  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
 
-DISTVERSION=	0.2
+DISTVERSION=	0.3
 
 srcdir=		@srcdir@
 VPATH=		@srcdir@
Index: adns/README
diff -u adns/README:1.3 adns/README:1.4
--- adns/README:1.3	Thu May 20 00:33:40 1999
+++ adns/README	Thu Jul 15 00:43:28 1999
@@ -37,11 +37,12 @@
 Forthcoming:
 
    I hope that future versions may also have the following features:
-     * The library will be useable by threads in a multithreaded program
-       in a natural way. It will multiplex many threads' queries through
-       a single query socket.
-     * Limited caching behaviour.
+     * The library should be useable by threads in a multithreaded
+       program in a natural way. It should multiplex many threads'
+       queries through a single query socket.
      * IPv6 support.
+     * Some kind of awareness of DNSSEC.
+     * Possibly some very limited caching behaviour.
        
    (Technical note: adns requires a real nameserver like BIND or [1]Dents
    running on the same system or a nearby one, which must be willing to
@@ -53,13 +54,19 @@
 
    I'm afraid there is no manual yet. However, competent C programmers
    should be able to use the library based on the commented [2]adns.h
-   header file (from version 0.1).
+   header file (from version 0.3).
    
 Feedback
 
-   If you are subscribed to adns-discuss please send bug reports there;
-   otherwise mail them to adns-bugreports@chiark.greenend.org.uk.
+   I'd be pleased if you would let me know if you're using my library in
+   your project, and what you think of it.
    
+   If you are subscribed to adns-discuss please send feedback, including
+   bug reports, there; otherwise send mail to
+   adns-bugreports@chiark.greenend.org.uk. If you'd prefer that your
+   message wasn't forwarded to the adns-bugreports list, send it to
+   adns-maint@chiark.greendend.org.uk.
+   
 Mailinglists
 
    I have set up mailinglists adns-announce and adns-discuss. The
@@ -117,11 +124,11 @@
 References
 
    1. http://www.dents.org/
-   2. http://www.chiark.greenend.org.uk/~ian/adns/adns.h.0.1.txt
+   2. http://www.chiark.greenend.org.uk/~ian/adns/adns.h.0.3.txt
    3. http://www.chiark.greenend.org.uk/mailman/listinfo
    4. http://www.chiark.greenend.org.uk/~ian/adns/
    5. http://www.chiark.greenend.org.uk/~ian/adns/adns.tar.gz
-   6. http://www.chiark.greenend.org.uk/~ian/adns/adns.h.0.1.txt
+   6. http://www.chiark.greenend.org.uk/~ian/adns/adns.h.0.3.txt
    7. ftp://ftp.chiark.greenend.org.uk/users/ian/adns/
    8. http://www.gnu.org/
    9. http://www.gnu.org/order/ftp.html
Index: adns/TODO
diff -u /dev/null adns/TODO:1.1
--- /dev/null	Thu Jul 15 00:51:03 1999
+++ adns/TODO	Thu Jun 17 00:16:05 1999
@@ -0,0 +1,7 @@
+DNSSEC compatibility
+ - be able to retreive KEY and SIG RRs
+
+DNSSEC functionality
+ - provide security
+
+Easy-to-use query tool
Index: adns/acconfig.h
diff -u adns/acconfig.h:1.1 adns/acconfig.h:1.3
--- adns/acconfig.h:1.1	Sun Mar 28 19:59:39 1999
+++ adns/acconfig.h	Wed Jul 14 23:59:34 1999
@@ -36,6 +36,16 @@
 
 /* Use the definitions: */
 
+#ifdef HAVE_POLL
+#include <sys/poll.h>
+#else
+/* kludge it up */
+struct pollfd { int fd; short events; short revents; };
+#define POLLIN  1
+#define POLLPRI 2
+#define POLLOUT 4
+#endif
+
 /* GNU C attributes. */
 #ifndef FUNCATTR
 #ifdef HAVE_GNUC25_ATTRIB
Index: adns/changelog
diff -u adns/changelog:1.11 adns/changelog:1.18
--- adns/changelog:1.11	Thu May 20 00:27:45 1999
+++ adns/changelog	Thu Jul 15 00:43:28 1999
@@ -1,3 +1,30 @@
+adns (0.3) unstable; urgency=low
+
+  Incompatible changes:
+  * Low adns_status values (below adns_s_max_tempfail) renumbered to make
+    room for future locally-induced and locally-detected errors.
+  * Event loop functions for use by select(2) renamed and tidied up.
+  
+  Features / improvements:
+  * New adns_errabbrev() for getting status abbreviation strings.
+  * regress/checkall prints summary list of failed tests, if any.
+  * Event loop functions for poll(2), and some raw variants.
+  * adnstest has ability to use poll(2), and user can set initflags.
+  * checkall prints passed list as well as failed list, if any failed.
+  * You can iterate over outstanding queries (but only once at a time).
+  
+  Bugfixes:
+  * Non-RFC822 mailbox `domain' formatting now works, and clarified.
+  * Rejection of bad characters in domains (without quoteok) works.
+  * Clean up parents from adns->childw (otherwise would abort/segfault).
+  * In adnstest, allocate enough space for, and terminate, query types.
+  * In adnstest, don't print errno values as adns_status values.
+ 
+  * Added TODO file.
+  * Made adnstest.c test context pointers.
+
+ -- Ian Jackson <ian@davenant.greenend.org.uk>  Thu, 15 Jul 1999 00:23:12 +0100
+
 adns (0.2) experimental; urgency=low
 
   Portability fixes for compilation on various platforms:
Index: adns/configure
diff -u adns/configure:1.5 adns/configure:1.6
--- adns/configure:1.5	Sun May  9 16:21:37 1999
+++ adns/configure	Mon Jul  5 02:50:59 1999
@@ -719,14 +719,69 @@
 fi
 
 
+for ac_func in poll
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:726: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 731 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
 
  echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:725: checking for socket" >&5
+echo "configure:780: checking for socket" >&5
 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 730 "configure"
+#line 785 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char socket(); below.  */
@@ -749,7 +804,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_socket=yes"
 else
@@ -768,7 +823,7 @@
   echo "$ac_t""no" 1>&6
 
   echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:772: checking for socket in -lsocket" >&5
+echo "configure:827: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -776,7 +831,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 780 "configure"
+#line 835 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -787,7 +842,7 @@
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -823,12 +878,12 @@
 
 
  echo $ac_n "checking for inet_ntoa""... $ac_c" 1>&6
-echo "configure:827: checking for inet_ntoa" >&5
+echo "configure:882: checking for inet_ntoa" >&5
 if eval "test \"`echo '$''{'ac_cv_func_inet_ntoa'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 832 "configure"
+#line 887 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char inet_ntoa(); below.  */
@@ -851,7 +906,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_inet_ntoa=yes"
 else
@@ -870,7 +925,7 @@
   echo "$ac_t""no" 1>&6
 
   echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6
-echo "configure:874: checking for inet_ntoa in -lnsl" >&5
+echo "configure:929: checking for inet_ntoa in -lnsl" >&5
 ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -878,7 +933,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 882 "configure"
+#line 937 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -889,7 +944,7 @@
 inet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -926,12 +981,12 @@
 
 
  echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
-echo "configure:930: checking for inet_aton" >&5
+echo "configure:985: checking for inet_aton" >&5
 if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 935 "configure"
+#line 990 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char inet_aton(); below.  */
@@ -954,7 +1009,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_inet_aton=yes"
 else
@@ -973,7 +1028,7 @@
   echo "$ac_t""no" 1>&6
 
   echo $ac_n "checking for inet_aton in -lresolv""... $ac_c" 1>&6
-echo "configure:977: checking for inet_aton in -lresolv" >&5
+echo "configure:1032: checking for inet_aton in -lresolv" >&5
 ac_lib_var=`echo resolv'_'inet_aton | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -981,7 +1036,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 985 "configure"
+#line 1040 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -992,7 +1047,7 @@
 inet_aton()
 ; return 0; }
 EOF
-if { (eval echo configure:996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1026,20 +1081,20 @@
 
  
  echo $ac_n "checking __attribute__((,,))""... $ac_c" 1>&6
-echo "configure:1030: checking __attribute__((,,))" >&5
+echo "configure:1085: checking __attribute__((,,))" >&5
  if eval "test \"`echo '$''{'adns_cv_c_attribute_supported'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 1036 "configure"
+#line 1091 "configure"
 #include "confdefs.h"
 
 int main() {
 extern int testfunction(int x) __attribute__((,,))
 ; return 0; }
 EOF
-if { (eval echo configure:1043: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   adns_cv_c_attribute_supported=yes
 else
@@ -1061,20 +1116,20 @@
 
    
  echo $ac_n "checking __attribute__((noreturn))""... $ac_c" 1>&6
-echo "configure:1065: checking __attribute__((noreturn))" >&5
+echo "configure:1120: checking __attribute__((noreturn))" >&5
  if eval "test \"`echo '$''{'adns_cv_c_attribute_noreturn'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 1071 "configure"
+#line 1126 "configure"
 #include "confdefs.h"
 
 int main() {
 extern int testfunction(int x) __attribute__((noreturn))
 ; return 0; }
 EOF
-if { (eval echo configure:1078: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   adns_cv_c_attribute_noreturn=yes
 else
@@ -1101,20 +1156,20 @@
 
    
  echo $ac_n "checking __attribute__((const))""... $ac_c" 1>&6
-echo "configure:1105: checking __attribute__((const))" >&5
+echo "configure:1160: checking __attribute__((const))" >&5
  if eval "test \"`echo '$''{'adns_cv_c_attribute_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 1111 "configure"
+#line 1166 "configure"
 #include "confdefs.h"
 
 int main() {
 extern int testfunction(int x) __attribute__((const))
 ; return 0; }
 EOF
-if { (eval echo configure:1118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   adns_cv_c_attribute_const=yes
 else
@@ -1141,20 +1196,20 @@
 
    
  echo $ac_n "checking __attribute__((format...))""... $ac_c" 1>&6
-echo "configure:1145: checking __attribute__((format...))" >&5
+echo "configure:1200: checking __attribute__((format...))" >&5
  if eval "test \"`echo '$''{'adns_cv_attribute_format'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   cat > conftest.$ac_ext <<EOF
-#line 1151 "configure"
+#line 1206 "configure"
 #include "confdefs.h"
 
 int main() {
 extern int testfunction(char *y, ...) __attribute__((format(printf,1,2)))
 ; return 0; }
 EOF
-if { (eval echo configure:1158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   adns_cv_attribute_format=yes
 else
Index: adns/configure.in
diff -u adns/configure.in:1.5 adns/configure.in:1.6
--- adns/configure.in:1.5	Sun May  9 16:21:09 1999
+++ adns/configure.in	Mon Jul  5 02:51:04 1999
@@ -21,6 +21,7 @@
 AC_PROG_CC
 AC_PROG_RANLIB
 
+AC_CHECK_FUNCS(poll)
 ADNS_C_GETFUNC(socket,socket)
 ADNS_C_GETFUNC(inet_ntoa,nsl)
 
Index: adns/client/adnstest.c
diff -u adns/client/adnstest.c:1.23 adns/client/adnstest.c:1.31
--- adns/client/adnstest.c:1.23	Sat Apr 17 15:44:21 1999
+++ adns/client/adnstest.c	Wed Jul 14 23:59:35 1999
@@ -25,18 +25,37 @@
 #include <unistd.h>
 #include <assert.h>
 #include <stdlib.h>
+#include <string.h>
+#include <errno.h>
 
+#include "adns.h"
+
+#include "config.h"
+
 #ifndef OUTPUTSTREAM
 # define OUTPUTSTREAM stdout
 #endif
 
-#include "adns.h"
+#ifndef HAVE_POLL
+#undef poll
+int poll(struct pollfd *ufds, int nfds, int timeout) {
+  fputs("poll(2) not supported on this system\n",stderr);
+  exit(3);
+}
+#define adns_beforepoll(a,b,c,d,e) 0
+#define adns_afterpoll(a,b,c,d) 0
+#endif
 
-static void failure(const char *what, adns_status st) {
+static void failure_status(const char *what, adns_status st) {
   fprintf(stderr,"adns failure: %s: %s\n",what,adns_strerror(st));
   exit(2);
 }
 
+static void failure_errno(const char *what, int errnoval) {
+  fprintf(stderr,"adns failure: %s: errno=%d\n",what,errnoval);
+  exit(2);
+}
+
 static const char *defaultargv[]= { "ns.chiark.greenend.org.uk", 0 };
 
 static const adns_rrtype defaulttypes[]= {
@@ -67,50 +86,102 @@
 	  ri ? " " : "", ri ? adns_strerror(ri) : "");
 }
 
-static void fdom_split(const char *fdom, const char **dom_r, int *qf_r) {
+static void fdom_split(const char *fdom, const char **dom_r, int *qf_r,
+		       char *ownflags, int ownflags_l) {
   int qf;
   char *ep;
 
   qf= strtoul(fdom,&ep,0);
+  if (*ep == ',' && strchr(ep,'/')) {
+    ep++;
+    while (*ep != '/') {
+      if (--ownflags_l <= 0) { fputs("too many flags\n",stderr); exit(3); }
+      *ownflags++= *ep++;
+    }
+  }
   if (*ep != '/') { *dom_r= fdom; *qf_r= 0; }
   else { *dom_r= ep+1; *qf_r= qf; }
+  *ownflags= 0;
 }
 
+static int consistsof(const char *string, const char *accept) {
+  return strspn(string,accept) == strlen(string);
+}
+
 int main(int argc, char *const *argv) {
+  struct myctx {
+    adns_query qu;
+    int doneyet, found;
+    const char *fdom;
+  };
+  
   adns_state ads;
-  adns_query *qus, qu;
+  adns_query qu;
+  struct myctx *mcs, *mc, *mcw;
+  void *mcr;
   adns_answer *ans;
   const char *initstring, *rrtn, *fmtn;
   const char *const *fdomlist, *domain;
   char *show, *cp;
-  int len, i, qc, qi, tc, ti, ch, qflags;
+  int len, i, qc, qi, tc, ti, ch, qflags, initflagsnum, npollfds, npollfdsavail, timeout;
+  struct pollfd *pollfds;
   adns_status r, ri;
   const adns_rrtype *types;
   struct timeval now;
   adns_rrtype *types_a;
+  char ownflags[10];
+  char *ep;
+  const char *initflags, *owninitflags;
 
+  if (argv[0] && argv[1] && argv[1][0] == '-') {
+    initflags= argv[1]+1;
+    argv++;
+  } else {
+    initflags= "";
+  }
   if (argv[0] && argv[1] && argv[1][0] == '/') {
     initstring= argv[1]+1;
     argv++;
   } else {
     initstring= 0;
   }
+
+  initflagsnum= strtoul(initflags,&ep,0);
+  if (*ep == ',') {
+    owninitflags= ep+1;
+    if (!consistsof(owninitflags,"ps")) {
+      fputs("unknown owninitflag\n",stderr);
+      exit(4);
+    }
+  } else if (!*ep) {
+    owninitflags= "";
+  } else {
+    fputs("bad <initflagsnum>[,<owninitflags>]\n",stderr);
+    exit(4);
+  }
   
   if (argv[0] && argv[1] && argv[1][0] == ':') {
     for (cp= argv[1]+1, tc=1; (ch= *cp); cp++)
       if (ch==',') tc++;
-    types_a= malloc(sizeof(*types_a)*tc);
+    types_a= malloc(sizeof(*types_a)*(tc+1));
     if (!types_a) { perror("malloc types"); exit(3); }
     for (cp= argv[1]+1, ti=0; ti<tc; ti++) {
       types_a[ti]= strtoul(cp,&cp,10);
       if ((ch= *cp)) {
 	if (ch != ',') {
-	  fputs("usage: dtest [/<initstring>] [:<typenum>,...] [<domain> ...]\n",stderr);
+	  fputs("usage: adnstest [-<initflagsnum>[,<owninitflags>]] [/<initstring>]\n"
+		"              [ :<typenum>,... ]\n"
+		"              [ [<queryflagsnum>[,<ownqueryflags>]/]<domain> ... ]\n"
+		"initflags:   p  use poll(2) instead of select(2)\n"
+		"             s  use adns_wait with specified query, instead of 0\n"
+		"queryflags:  a  print status abbrevs instead of strings\n",
+		stderr);
 	  exit(4);
 	}
 	cp++;
       }
     }
+    *cp++= adns_r_none;
     types= types_a;
     argv++;
   } else {
@@ -122,26 +193,42 @@
 
   for (qc=0; fdomlist[qc]; qc++);
   for (tc=0; types[tc] != adns_r_none; tc++);
-  qus= malloc(sizeof(qus)*qc*tc);
-  if (!qus) { perror("malloc qus"); exit(3); }
+  mcs= malloc(sizeof(*mcs)*qc*tc);
+  if (!mcs) { perror("malloc mcs"); exit(3); }
 
   if (initstring) {
-    r= adns_init_strcfg(&ads,adns_if_debug|adns_if_noautosys,stdout,initstring);
+    r= adns_init_strcfg(&ads,
+			(adns_if_debug|adns_if_noautosys)^initflagsnum,
+			stdout,initstring);
   } else {
-    r= adns_init(&ads,adns_if_debug|adns_if_noautosys,0);
+    r= adns_init(&ads,
+		 (adns_if_debug|adns_if_noautosys)^initflagsnum,
+		 0);
   }
-  if (r) failure("init",r);
+  if (r) failure_errno("init",r);
 
+  npollfdsavail= 0;
+  pollfds= 0;
+  
   for (qi=0; qi<qc; qi++) {
-    fdom_split(fdomlist[qi],&domain,&qflags);
+    fdom_split(fdomlist[qi],&domain,&qflags,ownflags,sizeof(ownflags));
+    if (!consistsof(ownflags,"a")) {
+      fputs("unknown ownqueryflag\n",stderr);
+      exit(4);
+    }
     for (ti=0; ti<tc; ti++) {
+      mc= &mcs[qi*tc+ti];
+      mc->doneyet= 0;
+      mc->fdom= fdomlist[qi];
+
       fprintf(stdout,"%s flags %d type %d",domain,qflags,types[ti]);
-      r= adns_submit(ads,domain,types[ti],qflags,0,&qus[qi*tc+ti]);
+      r= adns_submit(ads,domain,types[ti],qflags,mc,&mc->qu);
       if (r == adns_s_unknownrrtype) {
 	fprintf(stdout," not implemented\n");
-	qus[qi*tc+ti]= 0;
+	mc->qu= 0;
+	mc->doneyet= 1;
       } else if (r) {
-	failure("submit",r);
+	failure_errno("submit",r);
       } else {
 	ri= adns_rr_info(types[ti], &rrtn,&fmtn,0, 0,0);
 	putc(' ',stdout);
@@ -151,41 +238,99 @@
     }
   }
 
-  for (qi=0; qi<qc; qi++) {
-    fdom_split(fdomlist[qi],&domain,&qflags);
-      
-    for (ti=0; ti<tc; ti++) {
-      qu= qus[qi*tc+ti];
-      if (!qu) continue;
-      
-      r= adns_wait(ads,&qu,&ans,0);
-      if (r) failure("wait",r);
+  for (;;) {
+    for (qi=0; qi<qc; qi++) {
+      for (ti=0; ti<tc; ti++) {
+	mc= &mcs[qi*tc+ti];
+	mc->found= 0;
+      }
+    }
+    for (adns_forallqueries_begin(ads);
+	 (qu= adns_forallqueries_next(ads,&mcr));
+	 ) {
+      mc= mcr;
+      assert(qu == mc->qu);
+      assert(!mc->doneyet);
+      mc->found= 1;
+    }
+    mcw= 0;
+    for (qi=0; qi<qc; qi++) {
+      for (ti=0; ti<tc; ti++) {
+	mc= &mcs[qi*tc+ti];
+	if (mc->doneyet) continue;
+	assert(mc->found);
+	if (!mcw) mcw= mc;
+      }
+    }
+    if (!mcw) break;
 
-      if (gettimeofday(&now,0)) { perror("gettimeofday"); exit(3); }
-      
-      ri= adns_rr_info(ans->type, &rrtn,&fmtn,&len, 0,0);
-      fprintf(stdout, "%s flags %d type ",domain,qflags);
-      dumptype(ri,rrtn,fmtn);
-      fprintf(stdout, ": %s; nrrs=%d; cname=%s; owner=%s; ttl=%ld\n",
-	      adns_strerror(ans->status),
-	      ans->nrrs,
-	      ans->cname ? ans->cname : "$",
-	      ans->owner ? ans->owner : "$",
-	      (long)ans->expires - (long)now.tv_sec);
-      if (ans->nrrs) {
-	assert(!ri);
-	for (i=0; i<ans->nrrs; i++) {
-	  r= adns_rr_info(ans->type, 0,0,0, ans->rrs.bytes+i*len,&show);
-	  if (r) failure("info",r);
-	  fprintf(stdout," %s\n",show);
-	  free(show);
+    if (strchr(owninitflags,'s')) {
+      qu= mcw->qu;
+      mc= mcw;
+    } else {
+      qu= 0;
+      mc= 0;
+    }
+
+    if (strchr(owninitflags,'p')) {
+      for (;;) {
+	r= adns_check(ads,&qu,&ans,&mcr);
+	if (r != EWOULDBLOCK) break;
+	for (;;) {
+	  npollfds= npollfdsavail;
+	  timeout= -1;
+	  r= adns_beforepoll(ads, pollfds, &npollfds, &timeout, 0);
+	  if (r != ERANGE) break;
+	  pollfds= realloc(pollfds,sizeof(*pollfds)*npollfds);
+	  if (!pollfds) failure_errno("realloc pollfds",errno);
+	  npollfdsavail= npollfds;
 	}
+	if (r) failure_errno("beforepoll",r);
+	r= poll(pollfds,npollfds,timeout);
+	if (r == -1) failure_errno("poll",errno);
+	adns_afterpoll(ads,pollfds, r?npollfds:0, 0);
       }
-      free(ans);
+    } else {
+      r= adns_wait(ads,&qu,&ans,&mcr);
     }
+    if (r) failure_errno("wait/check",r);
+    
+    if (mc) assert(mcr==mc);
+    else mc= mcr;
+    assert(qu==mc->qu);
+    assert(!mc->doneyet);
+    
+    fdom_split(mc->fdom,&domain,&qflags,ownflags,sizeof(ownflags));
+
+    if (gettimeofday(&now,0)) { perror("gettimeofday"); exit(3); }
+      
+    ri= adns_rr_info(ans->type, &rrtn,&fmtn,&len, 0,0);
+    fprintf(stdout, "%s flags %d type ",domain,qflags);
+    dumptype(ri,rrtn,fmtn);
+    fprintf(stdout, "%s%s: %s; nrrs=%d; cname=%s; owner=%s; ttl=%ld\n",
+	    ownflags[0] ? " ownflags=" : "", ownflags,
+	    strchr(ownflags,'a')
+	    ? adns_errabbrev(ans->status)
+	    : adns_strerror(ans->status),
+	    ans->nrrs,
+	    ans->cname ? ans->cname : "$",
+	    ans->owner ? ans->owner : "$",
+	    (long)ans->expires - (long)now.tv_sec);
+    if (ans->nrrs) {
+      assert(!ri);
+      for (i=0; i<ans->nrrs; i++) {
+	r= adns_rr_info(ans->type, 0,0,0, ans->rrs.bytes + i*len, &show);
+	if (r) failure_status("info",r);
+	fprintf(stdout," %s\n",show);
+	free(show);
+      }
+    }
+    free(ans);
+
+    mc->doneyet= 1;
   }
 
-  free(qus);
+  free(mcs);
   adns_finish(ads);
   
   exit(0);
Index: adns/regress/Makefile.in
diff -u adns/regress/Makefile.in:1.9 adns/regress/Makefile.in:1.10
--- adns/regress/Makefile.in:1.9	Fri May 14 21:16:21 1999
+++ adns/regress/Makefile.in	Sun Jul 11 20:11:05 1999
@@ -27,7 +27,7 @@
 DIRCFLAGS=	-I$(srcdir)/../src
 
 HCPPFLAGS:= $(foreach F,			\
-	gettimeofday select			\
+	gettimeofday select poll		\
 	socket fcntl connect close		\
 	sendto recvfrom read write writev	\
 , -D$F=H$F)
Index: adns/regress/case-abbrev.out
diff -u /dev/null adns/regress/case-abbrev.out:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-abbrev.out	Thu Jun 17 01:53:59 1999
@@ -0,0 +1,40 @@
+adns debug: using nameserver 172.18.45.6
+greenend.org.uk flags 0 type 1 A(-) submitted
+greenend.org.uk flags 0 type 2 NS(raw) submitted
+greenend.org.uk flags 0 type 5 CNAME(-) submitted
+greenend.org.uk flags 0 type 6 SOA(raw) submitted
+greenend.org.uk flags 0 type 12 PTR(raw) submitted
+greenend.org.uk flags 0 type 13 HINFO(-) submitted
+greenend.org.uk flags 0 type 15 MX(raw) submitted
+greenend.org.uk flags 0 type 16 TXT(-) submitted
+greenend.org.uk flags 0 type 17 RP(raw) submitted
+greenend.org.uk flags 0 type 65537 A(addr) submitted
+greenend.org.uk flags 0 type 65538 NS(+addr) submitted
+greenend.org.uk flags 0 type 65548 PTR(checked) submitted
+greenend.org.uk flags 0 type 65551 MX(+addr) submitted
+greenend.org.uk flags 0 type 131078 SOA(822) submitted
+greenend.org.uk flags 0 type 131089 RP(822) submitted
+greenend.org.uk flags 0 type A(-) ownflags=a: nodata; nrrs=0; cname=$; owner=$; ttl=86400
+greenend.org.uk flags 0 type NS(raw) ownflags=a: ok; nrrs=2; cname=$; owner=$; ttl=86400
+ "ns1.relativity.greenend.org.uk"
+ "ns0.relativity.greenend.org.uk"
+greenend.org.uk flags 0 type CNAME(-) ownflags=a: nodata; nrrs=0; cname=$; owner=$; ttl=86400
+greenend.org.uk flags 0 type SOA(raw) ownflags=a: ok; nrrs=1; cname=$; owner=$; ttl=86400
+ "ns.chiark.greenend.org.uk" "hostmaster.greenend.org.uk" 1999061300 28800 7200 604800 86400
+greenend.org.uk flags 0 type PTR(raw) ownflags=a: nodata; nrrs=0; cname=$; owner=$; ttl=86400
+greenend.org.uk flags 0 type HINFO(-) ownflags=a: nodata; nrrs=0; cname=$; owner=$; ttl=86400
+greenend.org.uk flags 0 type MX(raw) ownflags=a: ok; nrrs=1; cname=$; owner=$; ttl=86400
+ 10 "chiark.greenend.org.uk"
+greenend.org.uk flags 0 type TXT(-) ownflags=a: nodata; nrrs=0; cname=$; owner=$; ttl=86400
+greenend.org.uk flags 0 type RP(raw) ownflags=a: nodata; nrrs=0; cname=$; owner=$; ttl=86400
+greenend.org.uk flags 0 type A(addr) ownflags=a: nodata; nrrs=0; cname=$; owner=$; ttl=86400
+greenend.org.uk flags 0 type NS(+addr) ownflags=a: ok; nrrs=2; cname=$; owner=$; ttl=86400
+ "ns0.relativity.greenend.org.uk": AF_INET 172.18.45.6
+ "ns1.relativity.greenend.org.uk": AF_INET 172.18.45.65
+greenend.org.uk flags 0 type PTR(checked) ownflags=a: nodata; nrrs=0; cname=$; owner=$; ttl=86400
+greenend.org.uk flags 0 type MX(+addr) ownflags=a: ok; nrrs=1; cname=$; owner=$; ttl=86400
+ 10 "chiark.greenend.org.uk": AF_INET 195.224.76.132
+greenend.org.uk flags 0 type SOA(822) ownflags=a: ok; nrrs=1; cname=$; owner=$; ttl=86400
+ "ns.chiark.greenend.org.uk" "hostmaster@greenend.org.uk" 1999061300 28800 7200 604800 86400
+greenend.org.uk flags 0 type RP(822) ownflags=a: nodata; nrrs=0; cname=$; owner=$; ttl=86400
+rc=0
Index: adns/regress/case-abbrev.sys
diff -u /dev/null adns/regress/case-abbrev.sys:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-abbrev.sys	Thu Jun 17 01:53:59 1999
@@ -0,0 +1,282 @@
+default
+,a/greenend.org.uk
+ start 929580078.542974
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000202
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000086
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000061
+ sendto fd=4 addr=172.18.45.6:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000623
+ sendto fd=4 addr=172.18.45.6:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000425
+ sendto fd=4 addr=172.18.45.6:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000371
+ sendto fd=4 addr=172.18.45.6:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000369
+ sendto fd=4 addr=172.18.45.6:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000369
+ sendto fd=4 addr=172.18.45.6:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000414
+ sendto fd=4 addr=172.18.45.6:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000371
+ sendto fd=4 addr=172.18.45.6:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000368
+ sendto fd=4 addr=172.18.45.6:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000368
+ sendto fd=4 addr=172.18.45.6:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000367
+ sendto fd=4 addr=172.18.45.6:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000367
+ sendto fd=4 addr=172.18.45.6:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000366
+ sendto fd=4 addr=172.18.45.6:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000378
+ sendto fd=4 addr=172.18.45.6:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000391
+ sendto fd=4 addr=172.18.45.6:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000467
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.993986
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005183
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     311f8580 00010000 00010000 08677265 656e656e 64036f72 6702756b 00000100
+     01c00c00 06000100 01518000 2d026e73 06636869 61726bc0 0c0a686f 73746d61
+     73746572 c00c7727 41340000 70800000 1c200009 3a800001 5180.
+ +0.000588
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000147
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.988691
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.004348
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31208580 00010002 00000002 08677265 656e656e 64036f72 6702756b 00000200
+     01c00c00 02000100 01518000 11036e73 310a7265 6c617469 76697479 c00cc00c
+     00020001 00015180 0006036e 7330c031 c02d0001 00010001 51800004 ac122d41
+     c04a0001 00010001 51800004 ac122d06.
+ +0.000642
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000247
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.983879
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.002737
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31218580 00010000 00010000 08677265 656e656e 64036f72 6702756b 00000500
+     01c00c00 06000100 01518000 2d026e73 06636869 61726bc0 0c0a686f 73746d61
+     73746572 c00c7727 41340000 70800000 1c200009 3a800001 5180.
+ +0.000541
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000099
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.980873
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005000
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31228580 00010001 00020002 08677265 656e656e 64036f72 6702756b 00000600
+     01c00c00 06000100 01518000 2d026e73 06636869 61726bc0 0c0a686f 73746d61
+     73746572 c00c7727 41340000 70800000 1c200009 3a800001 5180c00c 00020001
+     00015180 0011036e 73310a72 656c6174 69766974 79c00cc0 0c000200 01000151
+     80000603 6e7330c0 6ac06600 01000100 01518000 04ac122d 41c08300 01000100
+     01518000 04ac122d 06.
+ +0.000913
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000195
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.975134
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.002529
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31238580 00010000 00010000 08677265 656e656e 64036f72 6702756b 00000c00
+     01c00c00 06000100 01518000 2d026e73 06636869 61726bc0 0c0a686f 73746d61
+     73746572 c00c7727 41340000 70800000 1c200009 3a800001 5180.
+ +0.000541
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000100
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.972333
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003175
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31248580 00010000 00010000 08677265 656e656e 64036f72 6702756b 00000d00
+     01c00c00 06000100 01518000 2d026e73 06636869 61726bc0 0c0a686f 73746d61
+     73746572 c00c7727 41340000 70800000 1c200009 3a800001 5180.
+ +0.000538
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000122
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.968912
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005109
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31258580 00010001 00020003 08677265 656e656e 64036f72 6702756b 00000f00
+     01c00c00 0f000100 01518000 0b000a06 63686961 726bc00c c00c0002 00010001
+     51800011 036e7331 0a72656c 61746976 697479c0 0cc00c00 02000100 01518000
+     06036e73 30c048c0 2f000100 01000151 800004c3 e04c84c0 44000100 01000151
+     800004ac 122d41c0 61000100 01000151 800004ac 122d06.
+ +0.000826
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000173
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.963175
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.002746
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31268580 00010000 00010000 08677265 656e656e 64036f72 6702756b 00001000
+     01c00c00 06000100 01518000 2d026e73 06636869 61726bc0 0c0a686f 73746d61
+     73746572 c00c7727 41340000 70800000 1c200009 3a800001 5180.
+ +0.000539
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000127
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.960131
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003161
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31278580 00010000 00010000 08677265 656e656e 64036f72 6702756b 00001100
+     01c00c00 06000100 01518000 2d026e73 06636869 61726bc0 0c0a686f 73746d61
+     73746572 c00c7727 41340000 70800000 1c200009 3a800001 5180.
+ +0.000537
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000098
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.956703
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003055
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31288580 00010000 00010000 08677265 656e656e 64036f72 6702756b 00000100
+     01c00c00 06000100 01518000 2d026e73 06636869 61726bc0 0c0a686f 73746d61
+     73746572 c00c7727 41340000 70800000 1c200009 3a800001 5180.
+ +0.000537
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000126
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.953352
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.004322
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31298580 00010002 00000002 08677265 656e656e 64036f72 6702756b 00000200
+     01c00c00 02000100 01518000 11036e73 300a7265 6c617469 76697479 c00cc00c
+     00020001 00015180 0006036e 7331c031 c02d0001 00010001 51800004 ac122d06
+     c04a0001 00010001 51800004 ac122d41.
+ +0.000638
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000268
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.948491
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.002741
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312a8580 00010000 00010000 08677265 656e656e 64036f72 6702756b 00000c00
+     01c00c00 06000100 01518000 2d026e73 06636869 61726bc0 0c0a686f 73746d61
+     73746572 c00c7727 41340000 70800000 1c200009 3a800001 5180.
+ +0.000540
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000129
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.945447
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005215
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312b8580 00010001 00020003 08677265 656e656e 64036f72 6702756b 00000f00
+     01c00c00 0f000100 01518000 0b000a06 63686961 726bc00c c00c0002 00010001
+     51800011 036e7330 0a72656c 61746976 697479c0 0cc00c00 02000100 01518000
+     06036e73 31c048c0 2f000100 01000151 800004c3 e04c84c0 44000100 01000151
+     800004ac 122d06c0 61000100 01000151 800004ac 122d41.
+ +0.000822
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000197
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.939591
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.004484
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312c8580 00010001 00020002 08677265 656e656e 64036f72 6702756b 00000600
+     01c00c00 06000100 01518000 2d026e73 06636869 61726bc0 0c0a686f 73746d61
+     73746572 c00c7727 41340000 70800000 1c200009 3a800001 5180c00c 00020001
+     00015180 0011036e 73300a72 656c6174 69766974 79c00cc0 0c000200 01000151
+     80000603 6e7331c0 6ac06600 01000100 01518000 04ac122d 06c08300 01000100
+     01518000 04ac122d 41.
+ +0.000910
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000223
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.934365
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.002704
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312d8580 00010000 00010000 08677265 656e656e 64036f72 6702756b 00001100
+     01c00c00 06000100 01518000 2d026e73 06636869 61726bc0 0c0a686f 73746d61
+     73746572 c00c7727 41340000 70800000 1c200009 3a800001 5180.
+ +0.000537
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000099
+ close fd=4
+ close=OK
+ +0.000153
Index: adns/regress/case-abbrevto.out
diff -u /dev/null adns/regress/case-abbrevto.out:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-abbrevto.out	Thu Jun 17 01:54:00 1999
@@ -0,0 +1,32 @@
+adns debug: using nameserver 172.18.45.36
+greenend.org.uk flags 0 type 1 A(-) submitted
+greenend.org.uk flags 0 type 2 NS(raw) submitted
+greenend.org.uk flags 0 type 5 CNAME(-) submitted
+greenend.org.uk flags 0 type 6 SOA(raw) submitted
+greenend.org.uk flags 0 type 12 PTR(raw) submitted
+greenend.org.uk flags 0 type 13 HINFO(-) submitted
+greenend.org.uk flags 0 type 15 MX(raw) submitted
+greenend.org.uk flags 0 type 16 TXT(-) submitted
+greenend.org.uk flags 0 type 17 RP(raw) submitted
+greenend.org.uk flags 0 type 65537 A(addr) submitted
+greenend.org.uk flags 0 type 65538 NS(+addr) submitted
+greenend.org.uk flags 0 type 65548 PTR(checked) submitted
+greenend.org.uk flags 0 type 65551 MX(+addr) submitted
+greenend.org.uk flags 0 type 131078 SOA(822) submitted
+greenend.org.uk flags 0 type 131089 RP(822) submitted
+greenend.org.uk flags 0 type A(-) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type NS(raw) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type CNAME(-) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type SOA(raw) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type PTR(raw) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type HINFO(-) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type MX(raw) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type TXT(-) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type RP(raw) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type A(addr) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type NS(+addr) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type PTR(checked) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type MX(+addr) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type SOA(822) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+greenend.org.uk flags 0 type RP(822) ownflags=a: timeout; nrrs=0; cname=$; owner=$; ttl=604770
+rc=0
Index: adns/regress/case-abbrevto.sys
diff -u /dev/null adns/regress/case-abbrevto.sys:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-abbrevto.sys	Thu Jun 17 01:54:00 1999
@@ -0,0 +1,1236 @@
+noserver
+,a/greenend.org.uk
+ start 929580082.699581
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000192
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000084
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000062
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.014155
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000420
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000322
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000322
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000320
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000366
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000324
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000318
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000319
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000319
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000319
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000319
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000319
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000343
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000399
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.981116
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-18933
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000049
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.010028
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000363
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.003813
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009575
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000291
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000277
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000302
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000271
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000270
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000272
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000271
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000270
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000293
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000272
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000271
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000272
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000271
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.986185
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-14326
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000511
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009965
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000386
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000098
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009616
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000285
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000272
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000279
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000271
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000298
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000272
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000271
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000275
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.986134
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-14145
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000279
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009905
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000427
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000318
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000283
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000280
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000278
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000315
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000277
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000276
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000318
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000274
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.999573
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-04960
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000541
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009952
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000430
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000310
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000309
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000278
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000276
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000294
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000277
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000275
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.995632
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-04751
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000383
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009901
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000339
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000280
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000323
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000272
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000317
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000274
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.995734
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-04720
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000454
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009970
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000393
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000303
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000272
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000276
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000297
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000297
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.995695
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-04679
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000374
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009892
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000323
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000280
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000276
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000307
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000301
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000273
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.995776
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-04674
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000450
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009968
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000368
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000305
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000307
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000314
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000321
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000279
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000276
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000277
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000274
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.995636
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-04747
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000383
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009901
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000324
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000306
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000276
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000272
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000272
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000297
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000273
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.995790
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-04665
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000455
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009985
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000387
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000305
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000272
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000277
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000300
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000278
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000276
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000301
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.995681
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-04719
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000400
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009906
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000320
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000279
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000319
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000277
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000278
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000300
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000275
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.995757
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-04698
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000455
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009982
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000385
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000304
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000306
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000281
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000276
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000294
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000274
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.995688
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-04700
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000388
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009990
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000328
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000309
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000277
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000302
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000277
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000273
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.995768
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-04700
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000468
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009893
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000368
+ sendto fd=4 addr=172.18.45.36:53
+     31200100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000302
+ sendto fd=4 addr=172.18.45.36:53
+     31210100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000500
+     01.
+ sendto=33
+ +0.000272
+ sendto fd=4 addr=172.18.45.36:53
+     31220100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000276
+ sendto fd=4 addr=172.18.45.36:53
+     31230100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31240100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000d00
+     01.
+ sendto=33
+ +0.000275
+ sendto fd=4 addr=172.18.45.36:53
+     31250100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000321
+ sendto fd=4 addr=172.18.45.36:53
+     31260100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001000
+     01.
+ sendto=33
+ +0.000276
+ sendto fd=4 addr=172.18.45.36:53
+     31270100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31280100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000100
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     31290100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000200
+     01.
+ sendto=33
+ +0.000273
+ sendto fd=4 addr=172.18.45.36:53
+     312a0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000c00
+     01.
+ sendto=33
+ +0.000272
+ sendto fd=4 addr=172.18.45.36:53
+     312b0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000f00
+     01.
+ sendto=33
+ +0.000274
+ sendto fd=4 addr=172.18.45.36:53
+     312c0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00000600
+     01.
+ sendto=33
+ +0.000296
+ sendto fd=4 addr=172.18.45.36:53
+     312d0100 00010000 00000000 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=33
+ +0.000277
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.995699
+ select=0 rfds=[] wfds=[] efds=[]
+ +2.-04687
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000386
+ select=0 rfds=[] wfds=[] efds=[]
+ +0.009894
+ close fd=4
+ close=OK
+ +0.000779
Index: adns/regress/case-child.out
diff -u /dev/null adns/regress/case-child.out:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-child.out	Thu Jun 17 00:16:25 1999
@@ -0,0 +1,5 @@
+adns debug: using nameserver 172.18.45.6
+134.76.224.195.in-addr.arpa flags 0 type 65548 PTR(checked) submitted
+134.76.224.195.in-addr.arpa flags 0 type PTR(checked): OK; nrrs=1; cname=$; owner=$; ttl=78694
+ "permutation-city.greenend.org.uk"
+rc=0
Index: adns/regress/case-child.sys
diff -u /dev/null adns/regress/case-child.sys:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-child.sys	Thu Jun 17 00:16:25 1999
@@ -0,0 +1,58 @@
+default
+:65548 134.76.224.195.in-addr.arpa
+ start 929574747.401802
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000189
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000080
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000058
+ sendto fd=4 addr=172.18.45.6:53
+     311f0100 00010000 00000000 03313334 02373603 32323403 31393507 696e2d61
+     64647204 61727061 00000c00 01.
+ sendto=45
+ +0.000595
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.999405
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.008975
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     311f8180 00010001 00050005 03313334 02373603 32323403 31393507 696e2d61
+     64647204 61727061 00000c00 01c00c00 0c000100 01336600 22107065 726d7574
+     6174696f 6e2d6369 74790867 7265656e 656e6403 6f726702 756b0002 37360332
+     32340331 39350769 6e2d6164 64720461 72706100 00020001 00013366 00110464
+     6e733006 656c6d61 696c0263 6fc057c0 5b000200 01000133 66000704 646e7331
+     c083c05b 00020001 00013366 00070464 6e7332c0 83c05b00 02000100 01336600
+     0e036e73 32047861 7261036e 657400c0 5b000200 01000133 66000603 6e7333c0
+     c5c07e00 01000100 00149d00 04c17ae9 11c09b00 01000100 00149d00 04c17ae9
+     01c0ae00 01000100 00149d00 04c3e04c c1c0c100 01000100 0284e500 04c28fa1
+     6bc0db00 01000100 0284e500 04c28fa3 19.
+ +0.001671
+ sendto fd=4 addr=172.18.45.6:53
+     31200100 00010000 00000000 10706572 6d757461 74696f6e 2d636974 79086772
+     65656e65 6e64036f 72670275 6b000001 0001.
+ sendto=50
+ +0.000683
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000108
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.997538
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005811
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31208580 00010001 00020002 10706572 6d757461 74696f6e 2d636974 79086772
+     65656e65 6e64036f 72670275 6b000001 0001c00c 00010001 00015180 0004c3e0
+     4c860867 7265656e 656e6403 6f726702 756b0000 02000100 01518000 11036e73
+     300a7265 6c617469 76697479 c042c042 00020001 00015180 0006036e 7331c061
+     c05d0001 00010001 51800004 ac122d06 c07a0001 00010001 51800004 ac122d41.
+ +0.000862
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000193
+ close fd=4
+ close=OK
+ +0.000207
Index: adns/regress/case-flags10.err
diff -u /dev/null adns/regress/case-flags10.err:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-flags10.err	Thu Jun 17 01:54:01 1999
@@ -0,0 +1 @@
+too many flags
Index: adns/regress/case-flags10.out
diff -u /dev/null adns/regress/case-flags10.out:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-flags10.out	Thu Jun 17 01:54:01 1999
@@ -0,0 +1,2 @@
+adns debug: using nameserver 172.18.45.6
+rc=3
Index: adns/regress/case-flags10.sys
diff -u /dev/null adns/regress/case-flags10.sys:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-flags10.sys	Thu Jun 17 01:54:01 1999
@@ -0,0 +1,12 @@
+default
+:1 ,aaaaaaaaaa/chiark.greenend.org.uk
+ start 929580072.670441
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000191
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000084
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000061
Index: adns/regress/case-flags9.out
diff -u /dev/null adns/regress/case-flags9.out:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-flags9.out	Thu Jun 17 01:54:02 1999
@@ -0,0 +1,5 @@
+adns debug: using nameserver 172.18.45.6
+chiark.greenend.org.uk flags 0 type 1 A(-) submitted
+chiark.greenend.org.uk flags 0 type A(-) ownflags=aaaaaaaaa: ok; nrrs=1; cname=$; owner=$; ttl=86400
+ 195.224.76.132
+rc=0
Index: adns/regress/case-flags9.sys
diff -u /dev/null adns/regress/case-flags9.sys:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-flags9.sys	Thu Jun 17 01:54:03 1999
@@ -0,0 +1,34 @@
+default
+:1 ,aaaaaaaaa/chiark.greenend.org.uk
+ start 929580075.263215
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000212
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000083
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000060
+ sendto fd=4 addr=172.18.45.6:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000625
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.999375
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.007374
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     311f8580 00010001 00020002 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001 c00c0001 00010001 51800004 c3e04c84 08677265 656e656e
+     64036f72 6702756b 00000200 01000151 80001103 6e73300a 72656c61 74697669
+     7479c038 c0380002 00010001 51800006 036e7331 c057c053 00010001 00015180
+     0004ac12 2d06c070 00010001 00015180 0004ac12 2d41.
+ +0.001238
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000228
+ close fd=4
+ close=OK
+ +0.000205
Index: adns/regress/case-ndots-as.out
diff -u /dev/null adns/regress/case-ndots-as.out:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-ndots-as.out	Wed Jul 14 23:45:04 1999
@@ -0,0 +1,16 @@
+adns debug: using nameserver 172.18.45.6
+newsx.davenant flags 5 type 1 A(-) submitted
+news.davenant flags 5 type 1 A(-) submitted
+news.davenant.greenend.org.uk flags 5 type 1 A(-) submitted
+trunc.test.iwj.relativity flags 5 type 1 A(-) submitted
+trunx.test.iwj.relativity flags 5 type 1 A(-) submitted
+test.iwj.relativity flags 5 type 1 A(-) submitted
+news.davenant.greenend.org.uk flags 5 type A(-): OK; nrrs=1; cname=davenant.relativity.greenend.org.uk; owner=news.davenant.greenend.org.uk; ttl=86400
+ 172.18.45.6
+newsx.davenant flags 5 type A(-): No such domain; nrrs=0; cname=$; owner=newsx.davenant.greenend.org.uk; ttl=86400
+news.davenant flags 5 type A(-): OK; nrrs=1; cname=davenant.relativity.greenend.org.uk; owner=news.davenant.greenend.org.uk; ttl=86400
+ 172.18.45.6
+trunc.test.iwj.relativity flags 5 type A(-): No such data; nrrs=0; cname=$; owner=trunc.test.iwj.relativity.greenend.org.uk; ttl=60
+trunx.test.iwj.relativity flags 5 type A(-): No such domain; nrrs=0; cname=$; owner=trunx.test.iwj.relativity.greenend.org.uk; ttl=60
+test.iwj.relativity flags 5 type A(-): No such data; nrrs=0; cname=$; owner=test.iwj.relativity.greenend.org.uk; ttl=60
+rc=0
Index: adns/regress/case-ndots-as.sys
diff -u /dev/null adns/regress/case-ndots-as.sys:1.1
--- /dev/null	Thu Jul 15 00:51:04 1999
+++ adns/regress/case-ndots-as.sys	Wed Jul 14 23:45:04 1999
@@ -0,0 +1,316 @@
+default
+:1 5/newsx.davenant 5/news.davenant 5/news.davenant.greenend.org.uk 5/trunc.test.iwj.relativity 5/trunx.test.iwj.relativity 5/test.iwj.relativity
+ start 931992163.221752
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000186
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000086
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000066
+ sendto fd=4 addr=172.18.45.6:53
+     311f0100 00010000 00000000 056e6577 73780864 6176656e 616e7400 00010001.
+ sendto=32
+ +0.000567
+ sendto fd=4 addr=172.18.45.6:53
+     31200100 00010000 00000000 046e6577 73086461 76656e61 6e740000 010001.
+ sendto=31
+ +0.000453
+ sendto fd=4 addr=172.18.45.6:53
+     31210100 00010000 00000000 046e6577 73086461 76656e61 6e740867 7265656e
+     656e6403 6f726702 756b0000 010001.
+ sendto=47
+ +0.000507
+ sendto fd=4 addr=172.18.45.6:53
+     31220100 00010000 00000000 05747275 6e630474 65737403 69776a0a 72656c61
+     74697669 74790000 010001.
+ sendto=43
+ +0.000479
+ sendto fd=4 addr=172.18.45.6:53
+     31230100 00010000 00000000 05747275 6e780474 65737403 69776a0a 72656c61
+     74697669 74790000 010001.
+ sendto=43
+ +0.000624
+ sendto fd=4 addr=172.18.45.6:53
+     31240100 00010000 00000000 04746573 74036977 6a0a7265 6c617469 76697479
+     00000100 01.
+ sendto=37
+ +0.000457
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.996913
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.022284
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31218580 00010002 00030003 046e6577 73086461 76656e61 6e740867 7265656e
+     656e6403 6f726702 756b0000 010001c0 0c000500 01000151 80002508 64617665
+     6e616e74 0a72656c 61746976 69747908 67726565 6e656e64 036f7267 02756b00
+     c03b0001 00010001 51800004 ac122d06 c0440002 00010001 51800006 036e7330
+     c044c044 00020001 00015180 0006036e 7331c044 c0440002 00010001 51800006
+     036e7332 c044c07c 00010001 00015180 0004ac12 2d06c08e 00010001 00015180
+     0004ac12 2d41c0a0 00010001 00015180 0004ac12 2d01.
+ +0.001420
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000291
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.972918
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.387236
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     311f8583 00010000 00010000 056e6577 73780864 6176656e 616e7400 00010001
+     00000600 01000151 80003e01 410c524f 4f542d53 45525645 5253034e 4554000a
+     686f7374 6d617374 65720849 4e544552 4e4943c0 3a772768 44000007 08000003
+     8400093a 80000151 80.
+ +0.000745
+ sendto fd=4 addr=172.18.45.6:53
+     31250100 00010000 00000000 056e6577 73780864 6176656e 616e7408 64617665
+     6e616e74 08677265 656e656e 64036f72 6702756b 00000100 01.
+ sendto=57
+ +0.000559
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000102
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.584843
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005460
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31258583 00010000 00010000 056e6577 73780864 6176656e 616e7408 64617665
+     6e616e74 08677265 656e656e 64036f72 6702756b 00000100 01086772 65656e65
+     6e64036f 72670275 6b000006 00010001 5180002d 026e7306 63686961 726bc039
+     0a686f73 746d6173 746572c0 39772741 34000070 8000001c 2000093a 80000151
+     80.
+ +0.000861
+ sendto fd=4 addr=172.18.45.6:53
+     31260100 00010000 00000000 056e6577 73780864 6176656e 616e7408 67726565
+     6e656e64 036f7267 02756b00 00010001.
+ sendto=48
+ +0.000511
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000100
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.577911
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003716
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31268583 00010000 00010000 056e6577 73780864 6176656e 616e7408 67726565
+     6e656e64 036f7267 02756b00 00010001 08677265 656e656e 64036f72 6702756b
+     00000600 01000151 80002d02 6e730663 68696172 6bc0300a 686f7374 6d617374
+     6572c030 77274134 00007080 00001c20 00093a80 00015180.
+ +0.000808
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000127
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.573260
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.075508
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31208583 00010000 00010000 046e6577 73086461 76656e61 6e740000 01000100
+     00060001 00015180 003e0141 0c524f4f 542d5345 52564552 53034e45 54000a68
+     6f73746d 61737465 7208494e 5445524e 4943c039 77276844 00000708 00000384
+     00093a80 00015180.
+ +0.000755
+ sendto fd=4 addr=172.18.45.6:53
+     31270100 00010000 00000000 046e6577 73086461 76656e61 6e740864 6176656e
+     616e7408 67726565 6e656e64 036f7267 02756b00 00010001.
+ sendto=56
+ +0.000532
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000101
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.497324
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005326
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31278583 00010000 00010000 046e6577 73086461 76656e61 6e740864 6176656e
+     616e7408 67726565 6e656e64 036f7267 02756b00 00010001 08677265 656e656e
+     64036f72 6702756b 00000600 01000151 80002d02 6e730663 68696172 6bc0380a
+     686f7374 6d617374 6572c038 77274134 00007080 00001c20 00093a80 00015180.
+ +0.000855
+ sendto fd=4 addr=172.18.45.6:53
+     31280100 00010000 00000000 046e6577 73086461 76656e61 6e740867 7265656e
+     656e6403 6f726702 756b0000 010001.
+ sendto=47
+ +0.000503
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000100
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.490540
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.007220
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31288580 00010002 00030003 046e6577 73086461 76656e61 6e740867 7265656e
+     656e6403 6f726702 756b0000 010001c0 0c000500 01000151 80002508 64617665
+     6e616e74 0a72656c 61746976 69747908 67726565 6e656e64 036f7267 02756b00
+     c03b0001 00010001 51800004 ac122d06 c0440002 00010001 51800006 036e7330
+     c044c044 00020001 00015180 0006036e 7331c044 c0440002 00010001 51800006
+     036e7332 c044c07c 00010001 00015180 0004ac12 2d06c08e 00010001 00015180
+     0004ac12 2d41c0a0 00010001 00015180 0004ac12 2d01.
+ +0.001356
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000223
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.481741
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.023419
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31228583 00010000 00010000 05747275 6e630474 65737403 69776a0a 72656c61
+     74697669 74790000 01000100 00060001 00015180 003e0141 0c524f4f 542d5345
+     52564552 53034e45 54000a68 6f73746d 61737465 7208494e 5445524e 4943c045
+     77276844 00000708 00000384 00093a80 00015180.
+ +0.000802
+ sendto fd=4 addr=172.18.45.6:53
+     31290100 00010000 00000000 05747275 6e630474 65737403 69776a0a 72656c61
+     74697669 74790864 6176656e 616e7408 67726565 6e656e64 036f7267 02756b00
+     00010001.
+ sendto=68
+ +0.000607
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000101
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.457291
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005416
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31298583 00010000 00010000 05747275 6e630474 65737403 69776a0a 72656c61
+     74697669 74790864 6176656e 616e7408 67726565 6e656e64 036f7267 02756b00
+     00010001 08677265 656e656e 64036f72 6702756b 00000600 01000151 80002d02
+     6e730663 68696172 6bc0440a 686f7374 6d617374 6572c044 77274134 00007080
+     00001c20 00093a80 00015180.
+ +0.000925
+ sendto fd=4 addr=172.18.45.6:53
+     312a0100 00010000 00000000 05747275 6e630474 65737403 69776a0a 72656c61
+     74697669 74790867 7265656e 656e6403 6f726702 756b0000 010001.
+ sendto=59
+ +0.000575
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000101
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.450274
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.006009
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312a8580 00010000 00010000 05747275 6e630474 65737403 69776a0a 72656c61
+     74697669 74790867 7265656e 656e6403 6f726702 756b0000 01000104 74657374
+     0369776a 0a72656c 61746976 69747908 67726565 6e656e64 036f7267 02756b00
+     00060001 0000003c 0027036e 7330c044 0a686f73 746d6173 746572c0 44000000
+     1800000e 10000000 780064c8 00000000 3c.
+ +0.000954
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000145
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.443166
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.014229
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31238583 00010000 00010000 05747275 6e780474 65737403 69776a0a 72656c61
+     74697669 74790000 01000100 00060001 00015180 003e0141 0c524f4f 542d5345
+     52564552 53034e45 54000a68 6f73746d 61737465 7208494e 5445524e 4943c045
+     77276844 00000708 00000384 00093a80 00015180.
+ +0.000805
+ sendto fd=4 addr=172.18.45.6:53
+     312b0100 00010000 00000000 05747275 6e780474 65737403 69776a0a 72656c61
+     74697669 74790864 6176656e 616e7408 67726565 6e656e64 036f7267 02756b00
+     00010001.
+ sendto=68
+ +0.000606
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000101
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.428049
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005331
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312b8583 00010000 00010000 05747275 6e780474 65737403 69776a0a 72656c61
+     74697669 74790864 6176656e 616e7408 67726565 6e656e64 036f7267 02756b00
+     00010001 08677265 656e656e 64036f72 6702756b 00000600 01000151 80002d02
+     6e730663 68696172 6bc0440a 686f7374 6d617374 6572c044 77274134 00007080
+     00001c20 00093a80 00015180.
+ +0.000923
+ sendto fd=4 addr=172.18.45.6:53
+     312c0100 00010000 00000000 05747275 6e780474 65737403 69776a0a 72656c61
+     74697669 74790867 7265656e 656e6403 6f726702 756b0000 010001.
+ sendto=59
+ +0.000584
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000101
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.421110
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.004042
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312c8583 00010000 00010000 05747275 6e780474 65737403 69776a0a 72656c61
+     74697669 74790867 7265656e 656e6403 6f726702 756b0000 01000104 74657374
+     0369776a 0a72656c 61746976 69747908 67726565 6e656e64 036f7267 02756b00
+     00060001 0000003c 0027036e 7330c044 0a686f73 746d6173 746572c0 44000000
+     1800000e 10000000 780064c8 00000000 3c.
+ +0.000951
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000153
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.415964
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.026227
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31248583 00010000 00010000 04746573 74036977 6a0a7265 6c617469 76697479
+     00000100 01000006 00010001 5180003e 01410c52 4f4f542d 53455256 45525303
+     4e455400 0a686f73 746d6173 74657208 494e5445 524e4943 c03f7727 68440000
+     07080000 03840009 3a800001 5180.
+ +0.000817
+ sendto fd=4 addr=172.18.45.6:53
+     312d0100 00010000 00000000 04746573 74036977 6a0a7265 6c617469 76697479
+     08646176 656e616e 74086772 65656e65 6e64036f 72670275 6b000001 0001.
+ sendto=62
+ +0.000579
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000102
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.998502
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005185
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312d8583 00010000 00010000 04746573 74036977 6a0a7265 6c617469 76697479
+     08646176 656e616e 74086772 65656e65 6e64036f 72670275 6b000001 00010867
+     7265656e 656e6403 6f726702 756b0000 06000100 01518000 2d026e73 06636869
+     61726bc0 3e0a686f 73746d61 73746572 c03e7727 41340000 70800000 1c200009
+     3a800001 5180.
+ +0.000918
+ sendto fd=4 addr=172.18.45.6:53
+     312e0100 00010000 00000000 04746573 74036977 6a0a7265 6c617469 76697479
+     08677265 656e656e 64036f72 6702756b 00000100 01.
+ sendto=53
+ +0.000524
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000102
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.998456
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.004007
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312e8580 00010000 00010000 04746573 74036977 6a0a7265 6c617469 76697479
+     08677265 656e656e 64036f72 6702756b 00000100 01c00c00 06000100 00003c00
+     41036e73 300a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b
+     000a686f 73746d61 73746572 c0450000 00180000 0e100000 00780064 c8000000
+     003c.
+ +0.000867
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000175
+ close fd=4
+ close=OK
+ +0.000183
Index: adns/regress/case-ndots.sys
diff -u adns/regress/case-ndots.sys:1.2 adns/regress/case-ndots.sys:1.3
--- adns/regress/case-ndots.sys:1.2	Wed May 12 22:33:21 1999
+++ adns/regress/case-ndots.sys	Wed Jul 14 23:45:04 1999
@@ -1,4 +1,4 @@
-ndots
+ndots -,s
 :1 5/newsx.davenant 5/news.davenant 5/news.davenant.greenend.org.uk 5/trunc.test.iwj.relativity 5/trunx.test.iwj.relativity 5/test.iwj.relativity
  start 924365863.351594
  socket type=SOCK_DGRAM
Index: adns/regress/case-ndotsbad.err
diff -u adns/regress/case-ndotsbad.err:1.1 adns/regress/case-ndotsbad.err:1.2
--- adns/regress/case-ndotsbad.err:1.1	Sat Apr 17 17:23:14 1999
+++ adns/regress/case-ndotsbad.err	Thu Jun 17 01:54:03 1999
@@ -1 +1 @@
-adns failure: init: code 22
+adns failure: init: errno=22
Index: adns/regress/case-poll.out
diff -u /dev/null adns/regress/case-poll.out:1.1
--- /dev/null	Thu Jul 15 00:51:05 1999
+++ adns/regress/case-poll.out	Sun Jul 11 20:11:05 1999
@@ -0,0 +1,5 @@
+adns debug: using nameserver 172.18.45.6
+chiark.greenend.org.uk flags 0 type 1 A(-) submitted
+chiark.greenend.org.uk flags 0 type A(-): OK; nrrs=1; cname=$; owner=$; ttl=86400
+ 195.224.76.132
+rc=0
Index: adns/regress/case-poll.sys
diff -u /dev/null adns/regress/case-poll.sys:1.1
--- /dev/null	Thu Jul 15 00:51:05 1999
+++ adns/regress/case-poll.sys	Sun Jul 11 20:11:05 1999
@@ -0,0 +1,34 @@
+default -,p
+:1 chiark.greenend.org.uk
+ start 931719947.391142
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000208
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000087
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000066
+ sendto fd=4 addr=172.18.45.6:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000592
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=1 fds=[{fd=4, events=POLLIN, revents=POLLIN}]
+ +0.006530
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     311f8580 00010001 00020002 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001 c00c0001 00010001 51800004 c3e04c84 08677265 656e656e
+     64036f72 6702756b 00000200 01000151 80001103 6e73300a 72656c61 74697669
+     7479c038 c0380002 00010001 51800006 036e7331 c057c053 00010001 00015180
+     0004ac12 2d06c070 00010001 00015180 0004ac12 2d41.
+ +0.001044
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000211
+ close fd=4
+ close=OK
+ +0.000248
Index: adns/regress/case-polltimeout.out
diff -u /dev/null adns/regress/case-polltimeout.out:1.1
--- /dev/null	Thu Jul 15 00:51:05 1999
+++ adns/regress/case-polltimeout.out	Sun Jul 11 20:11:06 1999
@@ -0,0 +1,4 @@
+adns debug: using nameserver 172.18.45.36
+chiark.greenend.org.uk flags 0 type 1 A(-) submitted
+chiark.greenend.org.uk flags 0 type A(-): DNS query timed out; nrrs=0; cname=$; owner=$; ttl=604770
+rc=0
Index: adns/regress/case-polltimeout.sys
diff -u /dev/null adns/regress/case-polltimeout.sys:1.1
--- /dev/null	Thu Jul 15 00:51:05 1999
+++ adns/regress/case-polltimeout.sys	Sun Jul 11 20:11:06 1999
@@ -0,0 +1,135 @@
+noserver -,p
+:1 chiark.greenend.org.uk
+ start 931719968.733439
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000199
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000087
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000067
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000790
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009031
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000436
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009093
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000519
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.008993
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000500
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009010
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000486
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009050
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000485
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009014
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000485
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009045
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000451
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009050
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000483
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009042
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000433
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009083
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000521
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009017
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000442
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009058
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000510
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009012
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000436
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.009085
+ sendto fd=4 addr=172.18.45.36:53
+     311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000514
+ poll fds=[{fd=4, events=POLLIN, revents=0}] timeout=2000
+ poll=0 fds=[{fd=4, events=POLLIN, revents=0}]
+ +2.008998
+ close fd=4
+ close=OK
+ +0.000302
Index: adns/regress/case-rootqueryall-as.out
diff -u /dev/null adns/regress/case-rootqueryall-as.out:1.1
--- /dev/null	Thu Jul 15 00:51:05 1999
+++ adns/regress/case-rootqueryall-as.out	Wed Jul 14 23:45:05 1999
@@ -0,0 +1,118 @@
+adns debug: using nameserver 172.18.45.6
+. flags 0 type 1 A(-) submitted
+. flags 0 type 2 NS(raw) submitted
+. flags 0 type 5 CNAME(-) submitted
+. flags 0 type 6 SOA(raw) submitted
+. flags 0 type 12 PTR(raw) submitted
+. flags 0 type 13 HINFO(-) submitted
+. flags 0 type 15 MX(raw) submitted
+. flags 0 type 16 TXT(-) submitted
+. flags 0 type 17 RP(raw) submitted
+. flags 0 type 65537 A(addr) submitted
+. flags 0 type 65538 NS(+addr) submitted
+. flags 0 type 65548 PTR(checked) submitted
+. flags 0 type 65551 MX(+addr) submitted
+. flags 0 type 131078 SOA(822) submitted
+. flags 0 type 131089 RP(822) submitted
+. flags 1 type 1 A(-) submitted
+. flags 1 type 2 NS(raw) submitted
+. flags 1 type 5 CNAME(-) submitted
+. flags 1 type 6 SOA(raw) submitted
+. flags 1 type 12 PTR(raw) submitted
+. flags 1 type 13 HINFO(-) submitted
+. flags 1 type 15 MX(raw) submitted
+. flags 1 type 16 TXT(-) submitted
+. flags 1 type 17 RP(raw) submitted
+. flags 1 type 65537 A(addr) submitted
+. flags 1 type 65538 NS(+addr) submitted
+. flags 1 type 65548 PTR(checked) submitted
+. flags 1 type 65551 MX(+addr) submitted
+. flags 1 type 131078 SOA(822) submitted
+. flags 1 type 131089 RP(822) submitted
+. flags 0 type A(-): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 0 type NS(raw): OK; nrrs=13; cname=$; owner=$; ttl=518399
+ "E.ROOT-SERVERS.NET"
+ "I.ROOT-SERVERS.NET"
+ "F.ROOT-SERVERS.NET"
+ "G.ROOT-SERVERS.NET"
+ "J.ROOT-SERVERS.NET"
+ "K.ROOT-SERVERS.NET"
+ "L.ROOT-SERVERS.NET"
+ "M.ROOT-SERVERS.NET"
+ "A.ROOT-SERVERS.NET"
+ "H.ROOT-SERVERS.NET"
+ "B.ROOT-SERVERS.NET"
+ "C.ROOT-SERVERS.NET"
+ "D.ROOT-SERVERS.NET"
+. flags 0 type SOA(raw): OK; nrrs=1; cname=$; owner=$; ttl=82079
+ "A.ROOT-SERVERS.NET" "hostmaster.INTERNIC.NET" 1999071300 1800 900 604800 86400
+. flags 0 type PTR(raw): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 0 type HINFO(-): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 0 type MX(raw): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 0 type TXT(-): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 0 type RP(raw): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 0 type A(addr): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 0 type NS(+addr): OK; nrrs=13; cname=$; owner=$; ttl=518399
+ "I.ROOT-SERVERS.NET": AF_INET 192.36.148.17
+ "F.ROOT-SERVERS.NET": AF_INET 192.5.5.241
+ "G.ROOT-SERVERS.NET": AF_INET 192.112.36.4
+ "J.ROOT-SERVERS.NET": AF_INET 198.41.0.10
+ "K.ROOT-SERVERS.NET": AF_INET 193.0.14.129
+ "L.ROOT-SERVERS.NET": AF_INET 198.32.64.12
+ "M.ROOT-SERVERS.NET": AF_INET 202.12.27.33
+ "A.ROOT-SERVERS.NET": AF_INET 198.41.0.4
+ "H.ROOT-SERVERS.NET": AF_INET 128.63.2.53
+ "B.ROOT-SERVERS.NET": AF_INET 128.9.0.107
+ "C.ROOT-SERVERS.NET": AF_INET 192.33.4.12
+ "D.ROOT-SERVERS.NET": AF_INET 128.8.10.90
+ "E.ROOT-SERVERS.NET": AF_INET 192.203.230.10
+. flags 0 type PTR(checked): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 0 type MX(+addr): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 0 type SOA(822): OK; nrrs=1; cname=$; owner=$; ttl=77975
+ "A.ROOT-SERVERS.NET" "hostmaster@INTERNIC.NET" 1999071300 1800 900 604800 86400
+. flags 0 type RP(822): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 1 type A(-): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 1 type NS(raw): OK; nrrs=13; cname=$; owner=$; ttl=518399
+ "F.ROOT-SERVERS.NET"
+ "G.ROOT-SERVERS.NET"
+ "J.ROOT-SERVERS.NET"
+ "K.ROOT-SERVERS.NET"
+ "L.ROOT-SERVERS.NET"
+ "M.ROOT-SERVERS.NET"
+ "A.ROOT-SERVERS.NET"
+ "H.ROOT-SERVERS.NET"
+ "B.ROOT-SERVERS.NET"
+ "C.ROOT-SERVERS.NET"
+ "D.ROOT-SERVERS.NET"
+ "E.ROOT-SERVERS.NET"
+ "I.ROOT-SERVERS.NET"
+. flags 1 type SOA(raw): OK; nrrs=1; cname=$; owner=$; ttl=74076
+ "A.ROOT-SERVERS.NET" "hostmaster.INTERNIC.NET" 1999071300 1800 900 604800 86400
+. flags 1 type PTR(raw): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 1 type HINFO(-): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 1 type MX(raw): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 1 type TXT(-): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 1 type RP(raw): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 1 type A(addr): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 1 type NS(+addr): OK; nrrs=13; cname=$; owner=$; ttl=518399
+ "G.ROOT-SERVERS.NET": AF_INET 192.112.36.4
+ "J.ROOT-SERVERS.NET": AF_INET 198.41.0.10
+ "K.ROOT-SERVERS.NET": AF_INET 193.0.14.129
+ "L.ROOT-SERVERS.NET": AF_INET 198.32.64.12
+ "M.ROOT-SERVERS.NET": AF_INET 202.12.27.33
+ "A.ROOT-SERVERS.NET": AF_INET 198.41.0.4
+ "H.ROOT-SERVERS.NET": AF_INET 128.63.2.53
+ "B.ROOT-SERVERS.NET": AF_INET 128.9.0.107
+ "C.ROOT-SERVERS.NET": AF_INET 192.33.4.12
+ "D.ROOT-SERVERS.NET": AF_INET 128.8.10.90
+ "E.ROOT-SERVERS.NET": AF_INET 192.203.230.10
+ "I.ROOT-SERVERS.NET": AF_INET 192.36.148.17
+ "F.ROOT-SERVERS.NET": AF_INET 192.5.5.241
+. flags 1 type PTR(checked): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 1 type MX(+addr): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 1 type SOA(822): OK; nrrs=1; cname=$; owner=$; ttl=70372
+ "A.ROOT-SERVERS.NET" "hostmaster@INTERNIC.NET" 1999071300 1800 900 604800 86400
+. flags 1 type RP(822): No such data; nrrs=0; cname=$; owner=$; ttl=599
+. flags 0 type CNAME(-): No such data; nrrs=0; cname=$; owner=$; ttl=86400
+. flags 1 type CNAME(-): No such data; nrrs=0; cname=$; owner=$; ttl=86400
+rc=0
Index: adns/regress/case-rootqueryall-as.sys
diff -u /dev/null adns/regress/case-rootqueryall-as.sys:1.1
--- /dev/null	Thu Jul 15 00:51:05 1999
+++ adns/regress/case-rootqueryall-as.sys	Wed Jul 14 23:45:05 1999
@@ -0,0 +1,579 @@
+default
+. 1/.
+ start 931992019.753022
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000216
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000082
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000065
+ sendto fd=4 addr=172.18.45.6:53
+     311f0100 00010000 00000000 00000100 01.
+ sendto=17
+ +0.000454
+ sendto fd=4 addr=172.18.45.6:53
+     31200100 00010000 00000000 00000200 01.
+ sendto=17
+ +0.000348
+ sendto fd=4 addr=172.18.45.6:53
+     31210100 00010000 00000000 00000500 01.
+ sendto=17
+ +0.000303
+ sendto fd=4 addr=172.18.45.6:53
+     31220100 00010000 00000000 00000600 01.
+ sendto=17
+ +0.000298
+ sendto fd=4 addr=172.18.45.6:53
+     31230100 00010000 00000000 00000c00 01.
+ sendto=17
+ +0.000298
+ sendto fd=4 addr=172.18.45.6:53
+     31240100 00010000 00000000 00000d00 01.
+ sendto=17
+ +0.000375
+ sendto fd=4 addr=172.18.45.6:53
+     31250100 00010000 00000000 00000f00 01.
+ sendto=17
+ +0.000301
+ sendto fd=4 addr=172.18.45.6:53
+     31260100 00010000 00000000 00001000 01.
+ sendto=17
+ +0.000299
+ sendto fd=4 addr=172.18.45.6:53
+     31270100 00010000 00000000 00001100 01.
+ sendto=17
+ +0.000351
+ sendto fd=4 addr=172.18.45.6:53
+     31280100 00010000 00000000 00000100 01.
+ sendto=17
+ +0.000868
+ sendto fd=4 addr=172.18.45.6:53
+     31290100 00010000 00000000 00000200 01.
+ sendto=17
+ +0.000318
+ sendto fd=4 addr=172.18.45.6:53
+     312a0100 00010000 00000000 00000c00 01.
+ sendto=17
+ +0.000299
+ sendto fd=4 addr=172.18.45.6:53
+     312b0100 00010000 00000000 00000f00 01.
+ sendto=17
+ +0.000299
+ sendto fd=4 addr=172.18.45.6:53
+     312c0100 00010000 00000000 00000600 01.
+ sendto=17
+ +0.000297
+ sendto fd=4 addr=172.18.45.6:53
+     312d0100 00010000 00000000 00001100 01.
+ sendto=17
+ +0.000297
+ sendto fd=4 addr=172.18.45.6:53
+     312e0100 00010000 00000000 00000100 01.
+ sendto=17
+ +0.000307
+ sendto fd=4 addr=172.18.45.6:53
+     312f0100 00010000 00000000 00000200 01.
+ sendto=17
+ +0.000299
+ sendto fd=4 addr=172.18.45.6:53
+     31300100 00010000 00000000 00000500 01.
+ sendto=17
+ +0.000298
+ sendto fd=4 addr=172.18.45.6:53
+     31310100 00010000 00000000 00000600 01.
+ sendto=17
+ +0.000330
+ sendto fd=4 addr=172.18.45.6:53
+     31320100 00010000 00000000 00000c00 01.
+ sendto=17
+ +0.000323
+ sendto fd=4 addr=172.18.45.6:53
+     31330100 00010000 00000000 00000d00 01.
+ sendto=17
+ +0.000384
+ sendto fd=4 addr=172.18.45.6:53
+     31340100 00010000 00000000 00000f00 01.
+ sendto=17
+ +0.000302
+ sendto fd=4 addr=172.18.45.6:53
+     31350100 00010000 00000000 00001000 01.
+ sendto=17
+ +0.000300
+ sendto fd=4 addr=172.18.45.6:53
+     31360100 00010000 00000000 00001100 01.
+ sendto=17
+ +0.000296
+ sendto fd=4 addr=172.18.45.6:53
+     31370100 00010000 00000000 00000100 01.
+ sendto=17
+ +0.000298
+ sendto fd=4 addr=172.18.45.6:53
+     31380100 00010000 00000000 00000200 01.
+ sendto=17
+ +0.000298
+ sendto fd=4 addr=172.18.45.6:53
+     31390100 00010000 00000000 00000c00 01.
+ sendto=17
+ +0.000297
+ sendto fd=4 addr=172.18.45.6:53
+     313a0100 00010000 00000000 00000f00 01.
+ sendto=17
+ +0.000296
+ sendto fd=4 addr=172.18.45.6:53
+     313b0100 00010000 00000000 00000600 01.
+ sendto=17
+ +0.000326
+ sendto fd=4 addr=172.18.45.6:53
+     313c0100 00010000 00000000 00001100 01.
+ sendto=17
+ +0.000303
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.989938
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.007735
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     311f8180 00010000 00010000 00000100 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000703
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000151
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.981803
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.011771
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31208180 0001000d 0000000d 00000200 01000002 00010007 e8ff0014 01450c52
+     4f4f542d 53455256 45525303 4e455400 00000200 010007e8 ff000401 49c01e00
+     00020001 0007e8ff 00040146 c01e0000 02000100 07e8ff00 040147c0 1e000002
+     00010007 e8ff0004 014ac01e 00000200 010007e8 ff000401 4bc01e00 00020001
+     0007e8ff 0004014c c01e0000 02000100 07e8ff00 04014dc0 1e000002 00010007
+     e8ff0004 0141c01e 00000200 010007e8 ff000401 48c01e00 00020001 0007e8ff
+     00040142 c01e0000 02000100 07e8ff00 040143c0 1e000002 00010007 e8ff0004
+     0144c01e c01c0001 00010009 3a7f0004 c0cbe60a c03b0001 00010009 3a7f0004
+     c0249411 c04a0001 00010009 3a7f0004 c00505f1 c0590001 00010009 3a7f0004
+     c0702404 c0680001 00010009 3a7f0004 c629000a c0770001 00010009 3a7f0004
+     c1000e81 c0860001 00010009 3a7f0004 c620400c c0950001 00010009 3a7f0004
+     ca0c1b21 c0a40001 00010009 3a7f0004 c6290004 c0b30001 00010009 3a7f0004
+     803f0235 c0c20001 00010009 3a7f0004 8009006b c0d10001 00010009 3a7f0004
+     c021040c c0e00001 00010009 3a7f0004 80080a5a.
+ +0.002660
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000492
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.967228
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.016740
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31228180 00010001 000d000d 00000600 01000006 00010001 409f003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 51800000 02000100
+     07e8ff00 040145c0 1e000002 00010007 e8ff0004 0149c01e 00000200 010007e8
+     ff000401 46c01e00 00020001 0007e8ff 00040147 c01e0000 02000100 07e8ff00
+     04014ac0 1e000002 00010007 e8ff0004 014bc01e 00000200 010007e8 ff000401
+     4cc01e00 00020001 0007e8ff 0004014d c01e0000 02000100 07e8ff00 02c01c00
+     00020001 0007e8ff 00040148 c01e0000 02000100 07e8ff00 040142c0 1e000002
+     00010007 e8ff0004 0143c01e 00000200 010007e8 ff000401 44c01ec0 65000100
+     0100093a 7f0004c0 cbe60ac0 74000100 0100093a 7f0004c0 249411c0 83000100
+     0100093a 7f0004c0 0505f1c0 92000100 0100093a 7f0004c0 702404c0 a1000100
+     0100093a 7f0004c6 29000ac0 b0000100 0100093a 7f0004c1 000e81c0 bf000100
+     0100093a 7f0004c6 20400cc0 ce000100 0100093a 7f0004ca 0c1b21c0 1c000100
+     0100093a 7f0004c6 290004c0 ea000100 0100093a 7f000480 3f0235c0 f9000100
+     0100093a 7f000480 09006bc1 08000100 0100093a 7f0004c0 21040cc1 17000100
+     0100093a 7f000480 080a5a.
+ +0.002984
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000231
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.947273
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.000462
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31238180 00010000 00010000 00000c00 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000634
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000101
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.946076
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003306
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31248180 00010000 00010000 00000d00 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000640
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000124
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.942006
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003471
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31258180 00010000 00010000 00000f00 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000640
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000101
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.937794
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003503
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31268180 00010000 00010000 00001000 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000657
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000120
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.933514
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003470
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31278180 00010000 00010000 00001100 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000640
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000100
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.929304
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003089
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31288180 00010000 00010000 00000100 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000639
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000100
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.925476
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.011378
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31298180 0001000d 0000000d 00000200 01000002 00010007 e8ff0014 01490c52
+     4f4f542d 53455256 45525303 4e455400 00000200 010007e8 ff000401 46c01e00
+     00020001 0007e8ff 00040147 c01e0000 02000100 07e8ff00 04014ac0 1e000002
+     00010007 e8ff0004 014bc01e 00000200 010007e8 ff000401 4cc01e00 00020001
+     0007e8ff 0004014d c01e0000 02000100 07e8ff00 040141c0 1e000002 00010007
+     e8ff0004 0148c01e 00000200 010007e8 ff000401 42c01e00 00020001 0007e8ff
+     00040143 c01e0000 02000100 07e8ff00 040144c0 1e000002 00010007 e8ff0004
+     0145c01e c01c0001 00010009 3a7f0004 c0249411 c03b0001 00010009 3a7f0004
+     c00505f1 c04a0001 00010009 3a7f0004 c0702404 c0590001 00010009 3a7f0004
+     c629000a c0680001 00010009 3a7f0004 c1000e81 c0770001 00010009 3a7f0004
+     c620400c c0860001 00010009 3a7f0004 ca0c1b21 c0950001 00010009 3a7f0004
+     c6290004 c0a40001 00010009 3a7f0004 803f0235 c0b30001 00010009 3a7f0004
+     8009006b c0c20001 00010009 3a7f0004 c021040c c0d10001 00010009 3a7f0004
+     80080a5a c0e00001 00010009 3a7f0004 c0cbe60a.
+ +0.002666
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312a8180 00010000 00010000 00000c00 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.001684
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000096
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.909652
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003338
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312b8180 00010000 00010000 00000f00 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000643
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000106
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.905565
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.012071
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312c8180 00010001 000d000d 00000600 01000006 00010001 3097003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 51800000 02000100
+     07e8ff00 040149c0 1e000002 00010007 e8ff0004 0146c01e 00000200 010007e8
+     ff000401 47c01e00 00020001 0007e8ff 0004014a c01e0000 02000100 07e8ff00
+     04014bc0 1e000002 00010007 e8ff0004 014cc01e 00000200 010007e8 ff000401
+     4dc01e00 00020001 0007e8ff 0002c01c 00000200 010007e8 ff000401 48c01e00
+     00020001 0007e8ff 00040142 c01e0000 02000100 07e8ff00 040143c0 1e000002
+     00010007 e8ff0004 0144c01e 00000200 010007e8 ff000401 45c01ec0 65000100
+     0100093a 7f0004c0 249411c0 74000100 0100093a 7f0004c0 0505f1c0 83000100
+     0100093a 7f0004c0 702404c0 92000100 0100093a 7f0004c6 29000ac0 a1000100
+     0100093a 7f0004c1 000e81c0 b0000100 0100093a 7f0004c6 20400cc0 bf000100
+     0100093a 7f0004ca 0c1b21c0 1c000100 0100093a 7f0004c6 290004c0 db000100
+     0100093a 7f000480 3f0235c0 ea000100 0100093a 7f000480 09006bc0 f9000100
+     0100093a 7f0004c0 21040cc1 08000100 0100093a 7f000480 080a5ac1 17000100
+     0100093a 7f0004c0 cbe60a.
+ +0.002963
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000237
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.890294
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.000878
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312d8180 00010000 00010000 00001100 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000645
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000107
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.888664
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003147
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312e8180 00010000 00010000 00000100 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000643
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000141
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.884733
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.011290
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     312f8180 0001000d 0000000d 00000200 01000002 00010007 e8ff0014 01460c52
+     4f4f542d 53455256 45525303 4e455400 00000200 010007e8 ff000401 47c01e00
+     00020001 0007e8ff 0004014a c01e0000 02000100 07e8ff00 04014bc0 1e000002
+     00010007 e8ff0004 014cc01e 00000200 010007e8 ff000401 4dc01e00 00020001
+     0007e8ff 00040141 c01e0000 02000100 07e8ff00 040148c0 1e000002 00010007
+     e8ff0004 0142c01e 00000200 010007e8 ff000401 43c01e00 00020001 0007e8ff
+     00040144 c01e0000 02000100 07e8ff00 040145c0 1e000002 00010007 e8ff0004
+     0149c01e c01c0001 00010009 3a7f0004 c00505f1 c03b0001 00010009 3a7f0004
+     c0702404 c04a0001 00010009 3a7f0004 c629000a c0590001 00010009 3a7f0004
+     c1000e81 c0680001 00010009 3a7f0004 c620400c c0770001 00010009 3a7f0004
+     ca0c1b21 c0860001 00010009 3a7f0004 c6290004 c0950001 00010009 3a7f0004
+     803f0235 c0a40001 00010009 3a7f0004 8009006b c0b30001 00010009 3a7f0004
+     c021040c c0c20001 00010009 3a7f0004 80080a5a c0d10001 00010009 3a7f0004
+     c0cbe60a c0e00001 00010009 3a7f0004 c0249411.
+ +0.002658
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000400
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.870385
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.019033
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31318180 00010001 000d000d 00000600 01000006 00010001 215c003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 51800000 02000100
+     07e8ff00 040146c0 1e000002 00010007 e8ff0004 0147c01e 00000200 010007e8
+     ff000401 4ac01e00 00020001 0007e8ff 0004014b c01e0000 02000100 07e8ff00
+     04014cc0 1e000002 00010007 e8ff0004 014dc01e 00000200 010007e8 ff0002c0
+     1c000002 00010007 e8ff0004 0148c01e 00000200 010007e8 ff000401 42c01e00
+     00020001 0007e8ff 00040143 c01e0000 02000100 07e8ff00 040144c0 1e000002
+     00010007 e8ff0004 0145c01e 00000200 010007e8 ff000401 49c01ec0 65000100
+     0100093a 7f0004c0 0505f1c0 74000100 0100093a 7f0004c0 702404c0 83000100
+     0100093a 7f0004c6 29000ac0 92000100 0100093a 7f0004c1 000e81c0 a1000100
+     0100093a 7f0004c6 20400cc0 b0000100 0100093a 7f0004ca 0c1b21c0 1c000100
+     0100093a 7f0004c6 290004c0 cc000100 0100093a 7f000480 3f0235c0 db000100
+     0100093a 7f000480 09006bc0 ea000100 0100093a 7f0004c0 21040cc0 f9000100
+     0100093a 7f000480 080a5ac1 08000100 0100093a 7f0004c0 cbe60ac1 17000100
+     0100093a 7f0004c0 249411.
+ +0.002965
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000228
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.848159
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.000402
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31328180 00010000 00010000 00000c00 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000658
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000104
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.846995
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003222
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31338180 00010000 00010000 00000d00 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000645
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000107
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.843021
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003535
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31348180 00010000 00010000 00000f00 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000640
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000128
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.838718
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003396
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31358180 00010000 00010000 00001000 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000643
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000108
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.834571
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003560
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31368180 00010000 00010000 00001100 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000642
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000133
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.830236
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003060
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31378180 00010000 00010000 00000100 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000645
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000106
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.826425
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.011323
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31388180 0001000d 0000000d 00000200 01000002 00010007 e8ff0014 01470c52
+     4f4f542d 53455256 45525303 4e455400 00000200 010007e8 ff000401 4ac01e00
+     00020001 0007e8ff 0004014b c01e0000 02000100 07e8ff00 04014cc0 1e000002
+     00010007 e8ff0004 014dc01e 00000200 010007e8 ff000401 41c01e00 00020001
+     0007e8ff 00040148 c01e0000 02000100 07e8ff00 040142c0 1e000002 00010007
+     e8ff0004 0143c01e 00000200 010007e8 ff000401 44c01e00 00020001 0007e8ff
+     00040145 c01e0000 02000100 07e8ff00 040149c0 1e000002 00010007 e8ff0004
+     0146c01e c01c0001 00010009 3a7f0004 c0702404 c03b0001 00010009 3a7f0004
+     c629000a c04a0001 00010009 3a7f0004 c1000e81 c0590001 00010009 3a7f0004
+     c620400c c0680001 00010009 3a7f0004 ca0c1b21 c0770001 00010009 3a7f0004
+     c6290004 c0860001 00010009 3a7f0004 803f0235 c0950001 00010009 3a7f0004
+     8009006b c0a40001 00010009 3a7f0004 c021040c c0b30001 00010009 3a7f0004
+     80080a5a c0c20001 00010009 3a7f0004 c0cbe60a c0d10001 00010009 3a7f0004
+     c0249411 c0e00001 00010009 3a7f0004 c00505f1.
+ +0.002663
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31398180 00010000 00010000 00000c00 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.001663
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000127
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.810649
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003326
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     313a8180 00010000 00010000 00000f00 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000643
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000105
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.806575
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.025669
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     313b8180 00010001 000d000d 00000600 01000006 00010001 12e4003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 51800000 02000100
+     07e8ff00 040147c0 1e000002 00010007 e8ff0004 014ac01e 00000200 010007e8
+     ff000401 4bc01e00 00020001 0007e8ff 0004014c c01e0000 02000100 07e8ff00
+     04014dc0 1e000002 00010007 e8ff0002 c01c0000 02000100 07e8ff00 040148c0
+     1e000002 00010007 e8ff0004 0142c01e 00000200 010007e8 ff000401 43c01e00
+     00020001 0007e8ff 00040144 c01e0000 02000100 07e8ff00 040145c0 1e000002
+     00010007 e8ff0004 0149c01e 00000200 010007e8 ff000401 46c01ec0 65000100
+     0100093a 7f0004c0 702404c0 74000100 0100093a 7f0004c6 29000ac0 83000100
+     0100093a 7f0004c1 000e81c0 92000100 0100093a 7f0004c6 20400cc0 a1000100
+     0100093a 7f0004ca 0c1b21c0 1c000100 0100093a 7f0004c6 290004c0 bd000100
+     0100093a 7f000480 3f0235c0 cc000100 0100093a 7f000480 09006bc0 db000100
+     0100093a 7f0004c0 21040cc0 ea000100 0100093a 7f000480 080a5ac0 f9000100
+     0100093a 7f0004c0 cbe60ac1 08000100 0100093a 7f0004c0 249411c1 17000100
+     0100093a 7f0004c0 0505f1.
+ +0.002963
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000233
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.777710
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.004017
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     313c8180 00010000 00010000 00001100 01000006 00010000 0257003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000640
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000106
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.772947
+ select=1 rfds=[4] wfds=[] efds=[]
+ +1.-752512
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31218580 00010000 00010000 00000500 01000006 00010001 5180003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000649
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000106
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.529913
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.181054
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31308580 00010000 00010000 00000500 01000006 00010001 5180003e 01410c52
+     4f4f542d 53455256 45525303 4e455400 0a686f73 746d6173 74657208 494e5445
+     524e4943 c02b7727 68440000 07080000 03840009 3a800001 5180.
+ +0.000687
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000112
+ close fd=4
+ close=OK
+ +0.000197
Index: adns/regress/case-rootqueryall.out
diff -u adns/regress/case-rootqueryall.out:1.2 adns/regress/case-rootqueryall.out:1.3
--- adns/regress/case-rootqueryall.out:1.2	Sat Apr 17 17:23:18 1999
+++ adns/regress/case-rootqueryall.out	Thu Jun 17 01:54:04 1999
@@ -46,7 +46,7 @@
  "D.ROOT-SERVERS.NET"
 . flags 0 type CNAME(-): No such data; nrrs=0; cname=$; owner=$; ttl=86400
 . flags 0 type SOA(raw): OK; nrrs=1; cname=$; owner=$; ttl=54334
- "A.ROOT-SERVERS.NET" "hostmaster@INTERNIC.NET" 1999041600 1800 900 604800 86400
+ "A.ROOT-SERVERS.NET" "hostmaster.INTERNIC.NET" 1999041600 1800 900 604800 86400
 . flags 0 type PTR(raw): No such data; nrrs=0; cname=$; owner=$; ttl=599
 adns debug: reply not found, id 3123, query owner  (NS=172.18.45.6)
 . flags 0 type HINFO(-): No such data; nrrs=0; cname=$; owner=$; ttl=86400
@@ -93,7 +93,7 @@
  "I.ROOT-SERVERS.NET"
 . flags 1 type CNAME(-): No such data; nrrs=0; cname=$; owner=$; ttl=86400
 . flags 1 type SOA(raw): OK; nrrs=1; cname=$; owner=$; ttl=49034
- "A.ROOT-SERVERS.NET" "hostmaster@INTERNIC.NET" 1999041600 1800 900 604800 86400
+ "A.ROOT-SERVERS.NET" "hostmaster.INTERNIC.NET" 1999041600 1800 900 604800 86400
 . flags 1 type PTR(raw): No such data; nrrs=0; cname=$; owner=$; ttl=599
 . flags 1 type HINFO(-): No such data; nrrs=0; cname=$; owner=$; ttl=599
 adns debug: reply not found, id 3132, query owner  (NS=172.18.45.6)
Index: adns/regress/case-rootqueryall.sys
diff -u adns/regress/case-rootqueryall.sys:1.2 adns/regress/case-rootqueryall.sys:1.3
--- adns/regress/case-rootqueryall.sys:1.2	Wed May 12 22:33:26 1999
+++ adns/regress/case-rootqueryall.sys	Wed Jul 14 23:45:06 1999
@@ -1,4 +1,4 @@
-default
+default -,s
 . 1/.
  start 924364450.165424
  socket type=SOCK_DGRAM
Index: adns/regress/case-search-as.out
diff -u /dev/null adns/regress/case-search-as.out:1.1
--- /dev/null	Thu Jul 15 00:51:05 1999
+++ adns/regress/case-search-as.out	Wed Jul 14 23:45:07 1999
@@ -0,0 +1,14 @@
+adns debug: using nameserver 172.18.45.6
+news flags 5 type 1 A(-) submitted
+chiark flags 5 type 1 A(-) submitted
+news flags 1 type 1 A(-) submitted
+chiark flags 1 type 1 A(-) submitted
+news flags 5 type A(-): OK; nrrs=1; cname=davenant.relativity.greenend.org.uk; owner=news.davenant.greenend.org.uk; ttl=86400
+ 172.18.45.6
+news flags 1 type A(-): OK; nrrs=1; cname=davenant.relativity.greenend.org.uk; owner=$; ttl=86400
+ 172.18.45.6
+chiark flags 5 type A(-): OK; nrrs=1; cname=$; owner=chiark.greenend.org.uk; ttl=86400
+ 195.224.76.132
+chiark flags 1 type A(-): OK; nrrs=1; cname=$; owner=$; ttl=86400
+ 195.224.76.132
+rc=0
Index: adns/regress/case-search-as.sys
diff -u /dev/null adns/regress/case-search-as.sys:1.1
--- /dev/null	Thu Jul 15 00:51:05 1999
+++ adns/regress/case-search-as.sys	Wed Jul 14 23:45:07 1999
@@ -0,0 +1,131 @@
+default
+:1 0x5/news 0x5/chiark 1/news 1/chiark
+ start 931992052.232208
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000202
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000109
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000065
+ sendto fd=4 addr=172.18.45.6:53
+     311f0100 00010000 00000000 046e6577 73086461 76656e61 6e740867 7265656e
+     656e6403 6f726702 756b0000 010001.
+ sendto=47
+ +0.000696
+ sendto fd=4 addr=172.18.45.6:53
+     31200100 00010000 00000000 06636869 61726b08 64617665 6e616e74 08677265
+     656e656e 64036f72 6702756b 00000100 01.
+ sendto=49
+ +0.000559
+ sendto fd=4 addr=172.18.45.6:53
+     31210100 00010000 00000000 046e6577 73086461 76656e61 6e740867 7265656e
+     656e6403 6f726702 756b0000 010001.
+ sendto=47
+ +0.000991
+ sendto fd=4 addr=172.18.45.6:53
+     31220100 00010000 00000000 06636869 61726b08 64617665 6e616e74 08677265
+     656e656e 64036f72 6702756b 00000100 01.
+ sendto=49
+ +0.000516
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.997238
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.019885
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     311f8580 00010002 00030003 046e6577 73086461 76656e61 6e740867 7265656e
+     656e6403 6f726702 756b0000 010001c0 0c000500 01000151 80002508 64617665
+     6e616e74 0a72656c 61746976 69747908 67726565 6e656e64 036f7267 02756b00
+     c03b0001 00010001 51800004 ac122d06 c0440002 00010001 51800006 036e7330
+     c044c044 00020001 00015180 0006036e 7331c044 c0440002 00010001 51800006
+     036e7332 c044c07c 00010001 00015180 0004ac12 2d06c08e 00010001 00015180
+     0004ac12 2d41c0a0 00010001 00015180 0004ac12 2d01.
+ +0.001537
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000296
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.976216
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.001966
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31208583 00010000 00010000 06636869 61726b08 64617665 6e616e74 08677265
+     656e656e 64036f72 6702756b 00000100 01086772 65656e65 6e64036f 72670275
+     6b000006 00010001 5180002d 026e7306 63686961 726bc031 0a686f73 746d6173
+     746572c0 31772741 34000070 8000001c 2000093a 80000151 80.
+ +0.000819
+ sendto fd=4 addr=172.18.45.6:53
+     31230100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000471
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000102
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.973417
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.006224
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31218580 00010002 00030003 046e6577 73086461 76656e61 6e740867 7265656e
+     656e6403 6f726702 756b0000 010001c0 0c000500 01000151 80002508 64617665
+     6e616e74 0a72656c 61746976 69747908 67726565 6e656e64 036f7267 02756b00
+     c03b0001 00010001 51800004 ac122d06 c0440002 00010001 51800006 036e7330
+     c044c044 00020001 00015180 0006036e 7331c044 c0440002 00010001 51800006
+     036e7332 c044c07c 00010001 00015180 0004ac12 2d06c08e 00010001 00015180
+     0004ac12 2d41c0a0 00010001 00015180 0004ac12 2d01.
+ +0.001353
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000239
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.966592
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.001978
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31228583 00010000 00010000 06636869 61726b08 64617665 6e616e74 08677265
+     656e656e 64036f72 6702756b 00000100 01086772 65656e65 6e64036f 72670275
+     6b000006 00010001 5180002d 026e7306 63686961 726bc031 0a686f73 746d6173
+     746572c0 31772741 34000070 8000001c 2000093a 80000151 80.
+ +0.000817
+ sendto fd=4 addr=172.18.45.6:53
+     31240100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001.
+ sendto=40
+ +0.000436
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000101
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.987460
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.004418
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31238580 00010001 00020002 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001 c00c0001 00010001 51800004 c3e04c84 08677265 656e656e
+     64036f72 6702756b 00000200 01000151 80001103 6e73300a 72656c61 74697669
+     7479c038 c0380002 00010001 51800006 036e7331 c057c053 00010001 00015180
+     0004ac12 2d06c070 00010001 00015180 0004ac12 2d41.
+ +0.000982
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000180
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.993066
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003953
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31248580 00010001 00020002 06636869 61726b08 67726565 6e656e64 036f7267
+     02756b00 00010001 c00c0001 00010001 51800004 c3e04c84 08677265 656e656e
+     64036f72 6702756b 00000200 01000151 80001103 6e73300a 72656c61 74697669
+     7479c038 c0380002 00010001 51800006 036e7331 c057c053 00010001 00015180
+     0004ac12 2d06c070 00010001 00015180 0004ac12 2d41.
+ +0.000986
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000143
+ close fd=4
+ close=OK
+ +0.000193
Index: adns/regress/case-search.sys
diff -u adns/regress/case-search.sys:1.2 adns/regress/case-search.sys:1.3
--- adns/regress/case-search.sys:1.2	Wed May 12 22:33:27 1999
+++ adns/regress/case-search.sys	Wed Jul 14 23:45:07 1999
@@ -1,4 +1,4 @@
-default
+default -,s
 :1 0x5/news 0x5/chiark 1/news 1/chiark
  start 924360470.478357
  socket type=SOCK_DGRAM
Index: adns/regress/case-sillyrp.out
diff -u /dev/null adns/regress/case-sillyrp.out:1.1
--- /dev/null	Thu Jul 15 00:51:05 1999
+++ adns/regress/case-sillyrp.out	Thu Jun 17 01:54:04 1999
@@ -0,0 +1,20 @@
+adns debug: using nameserver 172.18.45.6
+silly-rp-dm.test.iwj.relativity.greenend.org.uk flags 112 type 17 RP(raw) submitted
+silly-rp-dm.test.iwj.relativity.greenend.org.uk flags 112 type 131089 RP(822) submitted
+silly-rp-lp.test.iwj.relativity.greenend.org.uk flags 112 type 17 RP(raw) submitted
+silly-rp-lp.test.iwj.relativity.greenend.org.uk flags 112 type 131089 RP(822) submitted
+silly-rp-lp.test.iwj.relativity.greenend.org.uk flags 0 type 17 RP(raw) submitted
+silly-rp-lp.test.iwj.relativity.greenend.org.uk flags 0 type 131089 RP(822) submitted
+silly-rp-dm.test.iwj.relativity.greenend.org.uk flags 0 type 17 RP(raw) submitted
+silly-rp-dm.test.iwj.relativity.greenend.org.uk flags 0 type 131089 RP(822) submitted
+silly-rp-dm.test.iwj.relativity.greenend.org.uk flags 112 type RP(raw): OK; nrrs=1; cname=$; owner=$; ttl=60
+ "i\\..root\\000null.org" ""
+silly-rp-dm.test.iwj.relativity.greenend.org.uk flags 112 type RP(822): Found syntactically invalid domain name; nrrs=0; cname=$; owner=$; ttl=60
+silly-rp-lp.test.iwj.relativity.greenend.org.uk flags 112 type RP(raw): OK; nrrs=1; cname=$; owner=$; ttl=60
+ "spong\\000flibble.ucam.org" ""
+silly-rp-lp.test.iwj.relativity.greenend.org.uk flags 112 type RP(822): Found invalid DNS data; nrrs=0; cname=$; owner=$; ttl=60
+silly-rp-lp.test.iwj.relativity.greenend.org.uk flags 0 type RP(raw): Found syntactically invalid domain name; nrrs=0; cname=$; owner=$; ttl=60
+silly-rp-lp.test.iwj.relativity.greenend.org.uk flags 0 type RP(822): Found invalid DNS data; nrrs=0; cname=$; owner=$; ttl=60
+silly-rp-dm.test.iwj.relativity.greenend.org.uk flags 0 type RP(raw): Found syntactically invalid domain name; nrrs=0; cname=$; owner=$; ttl=60
+silly-rp-dm.test.iwj.relativity.greenend.org.uk flags 0 type RP(822): Found syntactically invalid domain name; nrrs=0; cname=$; owner=$; ttl=60
+rc=0
Index: adns/regress/case-sillyrp.sys
diff -u /dev/null adns/regress/case-sillyrp.sys:1.1
--- /dev/null	Thu Jul 15 00:51:05 1999
+++ adns/regress/case-sillyrp.sys	Thu Jun 17 01:54:05 1999
@@ -0,0 +1,183 @@
+default
+:17,131089 0x70/silly-rp-dm.test.iwj.relativity.greenend.org.uk 0x70/silly-rp-lp.test.iwj.relativity.greenend.org.uk silly-rp-lp.test.iwj.relativity.greenend.org.uk silly-rp-dm.test.iwj.relativity.greenend.org.uk
+ start 929580348.131048
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000207
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000086
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000061
+ sendto fd=4 addr=172.18.45.6:53
+     311f0100 00010000 00000000 0b73696c 6c792d72 702d646d 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=65
+ +0.000768
+ sendto fd=4 addr=172.18.45.6:53
+     31200100 00010000 00000000 0b73696c 6c792d72 702d646d 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=65
+ +0.001010
+ sendto fd=4 addr=172.18.45.6:53
+     31210100 00010000 00000000 0b73696c 6c792d72 702d6c70 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=65
+ +0.000607
+ sendto fd=4 addr=172.18.45.6:53
+     31220100 00010000 00000000 0b73696c 6c792d72 702d6c70 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=65
+ +0.000543
+ sendto fd=4 addr=172.18.45.6:53
+     31230100 00010000 00000000 0b73696c 6c792d72 702d6c70 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=65
+ +0.000544
+ sendto fd=4 addr=172.18.45.6:53
+     31240100 00010000 00000000 0b73696c 6c792d72 702d6c70 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=65
+ +0.000535
+ sendto fd=4 addr=172.18.45.6:53
+     31250100 00010000 00000000 0b73696c 6c792d72 702d646d 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=65
+ +0.000538
+ sendto fd=4 addr=172.18.45.6:53
+     31260100 00010000 00000000 0b73696c 6c792d72 702d646d 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01.
+ sendto=65
+ +0.000569
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.994886
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005696
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     311f8580 00010001 00010001 0b73696c 6c792d72 702d646d 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01c00c00 11000100 00003c00 1302692e 09726f6f 74006e75 6c6c036f 72670000
+     04746573 74036977 6a0a7265 6c617469 76697479 08677265 656e656e 64036f72
+     6702756b 00000200 01000000 3c000603 6e7330c0 69c08f00 01000100 01518000
+     04ac122d 06.
+ +0.000936
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000308
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.988714
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003951
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31208580 00010001 00010001 0b73696c 6c792d72 702d646d 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01c00c00 11000100 00003c00 1302692e 09726f6f 74006e75 6c6c036f 72670000
+     04746573 74036977 6a0a7265 6c617469 76697479 08677265 656e656e 64036f72
+     6702756b 00000200 01000000 3c000603 6e7330c0 69c08f00 01000100 01518000
+     04ac122d 06.
+ +0.000891
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000192
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.984690
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003968
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31218580 00010001 00010001 0b73696c 6c792d72 702d6c70 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01c00c00 11000100 00003c00 190d7370 6f6e6700 666c6962 626c6504 7563616d
+     036f7267 00000474 65737403 69776a0a 72656c61 74697669 74790867 7265656e
+     656e6403 6f726702 756b0000 02000100 00003c00 06036e73 30c06fc0 95000100
+     01000151 800004ac 122d06.
+ +0.000915
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000193
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.980221
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.004041
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31228580 00010001 00010001 0b73696c 6c792d72 702d6c70 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01c00c00 11000100 00003c00 190d7370 6f6e6700 666c6962 626c6504 7563616d
+     036f7267 00000474 65737403 69776a0a 72656c61 74697669 74790867 7265656e
+     656e6403 6f726702 756b0000 02000100 00003c00 06036e73 30c06fc0 95000100
+     01000151 800004ac 122d06.
+ +0.000915
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000154
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.975654
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.003970
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31238580 00010001 00010001 0b73696c 6c792d72 702d6c70 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01c00c00 11000100 00003c00 190d7370 6f6e6700 666c6962 626c6504 7563616d
+     036f7267 00000474 65737403 69776a0a 72656c61 74697669 74790867 7265656e
+     656e6403 6f726702 756b0000 02000100 00003c00 06036e73 30c06fc0 95000100
+     01000151 800004ac 122d06.
+ +0.000911
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000173
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.971144
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005737
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31248580 00010001 00010001 0b73696c 6c792d72 702d6c70 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01c00c00 11000100 00003c00 190d7370 6f6e6700 666c6962 626c6504 7563616d
+     036f7267 00000474 65737403 69776a0a 72656c61 74697669 74790867 7265656e
+     656e6403 6f726702 756b0000 02000100 00003c00 06036e73 30c06fc0 95000100
+     01000151 800004ac 122d06.
+ +0.000914
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000151
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.964877
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.004001
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31258580 00010001 00010001 0b73696c 6c792d72 702d646d 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01c00c00 11000100 00003c00 1302692e 09726f6f 74006e75 6c6c036f 72670000
+     04746573 74036977 6a0a7265 6c617469 76697479 08677265 656e656e 64036f72
+     6702756b 00000200 01000000 3c000603 6e7330c0 69c08f00 01000100 01518000
+     04ac122d 06.
+ +0.000911
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000155
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.960348
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.004043
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31268580 00010001 00010001 0b73696c 6c792d72 702d646d 04746573 74036977
+     6a0a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b 00001100
+     01c00c00 11000100 00003c00 1302692e 09726f6f 74006e75 6c6c036f 72670000
+     04746573 74036977 6a0a7265 6c617469 76697479 08677265 656e656e 64036f72
+     6702756b 00000200 01000000 3c000603 6e7330c0 69c08f00 01000100 01518000
+     04ac122d 06.
+ +0.000886
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000191
+ close fd=4
+ close=OK
+ +0.000160
Index: adns/regress/checkall
diff -u adns/regress/checkall:1.1 adns/regress/checkall:1.3
--- adns/regress/checkall:1.1	Sun Nov 29 19:09:29 1998
+++ adns/regress/checkall	Sun Jul 11 19:15:16 1999
@@ -1,29 +1,32 @@
 #!/bin/sh
 
-allok=true
+failed=''
+passed=''
 
 for f in case-*.sys
 do
 	case="`echo \"$f\" | sed -e 's/^case-//; s/\.sys$//'`"
 	if ./r1test $case
 	then
-		:
+		passed="$passed $case"
 	else
 		echo
-		allok=false
+		failed="$failed $case"
 		echo
 	fi
 done
 
-if $allok
+if [ "x$failed" = x ]
 then
 	echo "
 all tests passed."
 	exit 0
 fi
 
-echo >&2 '
+echo >&2 "
 AT LEAST ONE TEST FAILED
-'
+passed tests:${passed:- NONE}
+failed tests:$failed
+"
 
 exit 1
Index: adns/regress/harness.h.m4
diff -u adns/regress/harness.h.m4:1.4 adns/regress/harness.h.m4:1.5
--- adns/regress/harness.h.m4:1.4	Tue Mar 30 19:57:09 1999
+++ adns/regress/harness.h.m4	Sun Jul 11 20:11:06 1999
@@ -27,6 +27,7 @@
 #include <sys/socket.h>
 #include <sys/uio.h>
 #include <unistd.h>
+#include <sys/poll.h>
 
 #include "internal.h"
 
@@ -62,6 +63,7 @@
 void Tvbf(const char *fmt, ...) PRINTFFORMAT(1,2);
 void Tvbvf(const char *fmt, va_list al);
 void Tvbfdset(int max, const fd_set *set);
+void Tvbpollfds(const struct pollfd *fds, int nfds);
 void Tvbaddr(const struct sockaddr *addr, int addrlen);
 void Tvbbytes(const void *buf, int len);
 void Tvberrno(int e);
Index: adns/regress/hcommon.c.m4
diff -u adns/regress/hcommon.c.m4:1.5 adns/regress/hcommon.c.m4:1.6
--- adns/regress/hcommon.c.m4:1.5	Wed May 12 22:33:33 1999
+++ adns/regress/hcommon.c.m4	Sun Jul 11 20:11:06 1999
@@ -77,6 +77,7 @@
  m4_define(`hm_arg_nullptr',`')
  m4_define(`hm_arg_int', `Tvbf(" $'`1=%d",$'`1);')
  m4_define(`hm_arg_fdset_io', `Tvbf(" $'`1="); Tvbfdset($'`2,$'`1);')
+ m4_define(`hm_arg_pollfds_io', `Tvbf(" $'`1="); Tvbpollfds($'`1,$'`2);')
  m4_define(`hm_arg_timeval_in_rel_null', `
   if ($'`1) Tvbf(" $'`1=%ld.%06ld",(long)$'`1->tv_sec,(long)$'`1->tv_usec);
   else Tvba(" $'`1=null");')
@@ -141,6 +142,33 @@
     Tvba(comma);
     Tvbf("%d",i);
     comma= ",";
+  }
+  Tvba("]");
+}
+
+static void Tvbpollevents(int events) {
+  const char *delim= "";
+
+  events &= (POLLIN|POLLOUT|POLLPRI);
+  if (!events) { Tvba("0"); return; }
+  if (events & POLLIN) { Tvba("POLLIN"); delim= "|"; }
+  if (events & POLLOUT) { Tvba(delim); Tvba("POLLOUT"); delim= "|"; }
+  if (events & POLLPRI) { Tvba(delim); Tvba("POLLPRI"); }
+}
+
+void Tvbpollfds(const struct pollfd *fds, int nfds) {
+  const char *comma= "";
+  
+  Tvba("[");
+  while (nfds>0) {
+    Tvba(comma);
+    Tvbf("{fd=%d, events=",fds->fd);
+    Tvbpollevents(fds->events);
+    Tvba(", revents=");
+    Tvbpollevents(fds->revents);
+    Tvba("}");
+    comma= ", ";
+    nfds--; fds++;
   }
   Tvba("]");
 }
Index: adns/regress/hmacros.i4
diff -u adns/regress/hmacros.i4:1.4 adns/regress/hmacros.i4:1.5
--- adns/regress/hmacros.i4:1.4	Tue Mar 30 19:57:12 1999
+++ adns/regress/hmacros.i4	Sun Jul 11 20:11:06 1999
@@ -38,6 +38,7 @@
  m4_define(`hm_arg_nullptr', `')
  m4_define(`hm_arg_int', `')
  m4_define(`hm_arg_fdset_io', `')
+ m4_define(`hm_arg_pollfds_io', `')
  m4_define(`hm_arg_timeval_in_rel_null',`')
  m4_define(`hm_arg_must', `')
  m4_define(`hm_arg_socktype',`')
@@ -55,6 +56,7 @@
  m4_define(`hm_arg_nullptr', `$'`1 $'`2')
  m4_define(`hm_arg_int', `int $'`1')
  m4_define(`hm_arg_fdset_io', `fd_set *$'`1')
+ m4_define(`hm_arg_pollfds_io', `struct pollfd *$'`1 hm_comma int $'`2')
  m4_define(`hm_arg_timeval_in_rel_null', `struct timeval *$'`1')
  m4_define(`hm_arg_must', `$'`1 $'`2')
  m4_define(`hm_arg_socktype', `int $'`1')
@@ -71,6 +73,7 @@
  hm_create_proto_h
  m4_define(`hm_arg_nullptr', `')
  m4_define(`hm_arg_fdset_io', `const fd_set *$'`1')
+ m4_define(`hm_arg_pollfds_io', `const struct pollfd *$'`1 hm_comma int $'`2')
  m4_define(`hm_arg_must', `')
  m4_define(`hm_arg_ign', `')
  m4_define(`hm_arg_fcntl_cmd_arg', `int $'`1 hm_comma long $'`2')
@@ -104,6 +107,7 @@
  m4_define(`hm_arg_nullptr', `0')
  m4_define(`hm_arg_int', `$'`1')
  m4_define(`hm_arg_fdset_io', `$'`1')
+ m4_define(`hm_arg_pollfds_io', `$'`1 hm_comma $'`2')
  m4_define(`hm_arg_timeval_in_rel_null', `$'`1')
  m4_define(`hm_arg_must', `$'`2')
  m4_define(`hm_arg_socktype', `$'`1')
Index: adns/regress/hplayback.c.m4
diff -u adns/regress/hplayback.c.m4:1.5 adns/regress/hplayback.c.m4:1.6
--- adns/regress/hplayback.c.m4:1.5	Wed May 12 22:33:34 1999
+++ adns/regress/hplayback.c.m4	Sun Jul 11 20:11:06 1999
@@ -89,6 +89,20 @@
   if (vb2.buf[vb2.used++] != hm_squote=hm_squote) Psyntax("not = after argument name");
 }
 
+static int Pstring_maybe(const char *string) {
+  int l;
+
+  l= strlen(string);
+  if (memcmp(vb2.buf+vb2.used,string,l)) return 0;
+  vb2.used+= l;
+  return 1;
+}
+
+static void Pstring(const char *string, const char *emsg) {
+  if (Pstring_maybe(string)) return;
+  Psyntax(emsg);
+}
+
 static int Perrno(const char *stuff) {
   const struct Terrno *te;
   int r;
@@ -136,6 +150,47 @@
   }
 }
 
+static int Ppollfdevents(void) {
+  int events;
+
+  if (Pstring_maybe("0")) return 0;
+  events= 0;
+
+  if (Pstring_maybe("POLLIN")) {
+    events |= POLLIN;
+    if (!Pstring_maybe("|")) return events;
+  }
+
+  if (Pstring_maybe("POLLOUT")) {
+    events |= POLLOUT;
+    if (!Pstring_maybe("|")) return events;
+  }
+
+  Pstring("POLLPRI","pollfdevents PRI?");
+  return events;
+}
+
+static void Ppollfds(struct pollfd *fds, int nfds) {
+  int i;
+  char *ep;
+  const char *comma= "";
+  
+  if (vb2.buf[vb2.used++] != hm_squote[hm_squote) Psyntax("pollfds start not [");
+  for (i=0; i<nfds; i++) {
+    Pstring("{fd=","{fd= in pollfds");
+    fds->fd= strtoul(vb2.buf+vb2.used,&ep,10);
+    vb2.used= ep - (char*)vb2.buf;    
+    Pstring(", events=",", events= in pollfds");
+    fds->events= Ppollfdevents();
+    Pstring(", revents=",", revents= in pollfds");
+    fds->revents= Ppollfdevents();
+    Pstring("}","} in pollfds");
+    Pstring(comma,"separator in pollfds");
+    comma= ", ";
+  }
+  if (vb2.buf[vb2.used++] != hm_squote]hm_squote) Psyntax("pollfds end not ]");
+}
+
 static void Paddr(struct sockaddr *addr, int *lenr) {
   struct sockaddr_in *sa= (struct sockaddr_in*)addr;
   char *p, *ep;
@@ -281,6 +336,7 @@
 
  hm_create_nothing
  m4_define(`hm_arg_fdset_io',`Parg("$'`1"); Pfdset($'`1,$'`2);')
+ m4_define(`hm_arg_pollfds_io',`Parg("$'`1"); Ppollfds($'`1,$'`2);')
  m4_define(`hm_arg_addr_out',`Parg("$'`1"); Paddr($'`1,$'`2);')
  $3
  if (vb2.used != vb2.avail) Psyntax("junk at end of line");
Index: adns/regress/hrecord.c.m4
diff -u adns/regress/hrecord.c.m4:1.8 adns/regress/hrecord.c.m4:1.9
--- adns/regress/hrecord.c.m4:1.8	Thu May 20 00:26:23 1999
+++ adns/regress/hrecord.c.m4	Sun Jul 11 20:11:07 1999
@@ -120,6 +120,7 @@
 
  hm_create_nothing
  m4_define(`hm_arg_fdset_io',`Tvba(" $'`1="); Tvbfdset($'`2,$'`1);')
+ m4_define(`hm_arg_pollfds_io',`Tvba(" $'`1="); Tvbpollfds($'`1,$'`2);')
  m4_define(`hm_arg_addr_out',`Tvba(" $'`1="); Tvbaddr($'`1,*$'`2);')
  $3
 
Index: adns/regress/hsyscalls.i4
diff -u adns/regress/hsyscalls.i4:1.4 adns/regress/hsyscalls.i4:1.5
--- adns/regress/hsyscalls.i4:1.4	Wed May 12 22:33:37 1999
+++ adns/regress/hsyscalls.i4	Sun Jul 11 20:11:07 1999
@@ -57,6 +57,12 @@
 ')
 
 hm_syscall(
+	poll, `hm_rv_any', `
+        hm_arg_pollfds_io(fds,nfds) hm_na
+	hm_arg_int(timeout) hm_na
+')
+
+hm_syscall(
 	socket, `hm_rv_fd', `
 	hm_arg_must(int,domain,AF_INET) hm_na
 	hm_arg_socktype(type) hm_na
Index: adns/regress/junk
diff -u adns/regress/junk:1.3 adns/regress/junk:removed
--- adns/regress/junk:1.3	Sun Nov 29 15:33:32 1998
+++ adns/regress/junk	Thu Jul 15 00:51:05 1999
@@ -1,201 +0,0 @@
-
-
-
-m4_define(`hm_arg_timeval_out_abs', `')
-m4_define(`hm_arg_nullptr', `')
-m4_define(`hm_arg_fdset_io', `const fd_set *$1 $3')
-m4_define(`hm_arg_must', `')
-m4_define(`hm_arg_ign', `')
-m4_define(`hm_arg_fcntl_arg', `long arg')
-m4_define(`hm_arg_bytes_out', `$3 $4 $6')
-m4_define(`hm_arg_addr_out', `int $2 $3')
-
-
-m4_define(`hm_syscall', `void Q$1(hm_args_checkvoid(`$3'));')
-
-
-
-
-
-int Hgettimeofday(struct timeval *tv, struct timezone *tz) {
-  int r;
-  struct timeval diff;
-
-  assert(tv); assert(!tz);
-
-  Qgettimeofday();
-
-  r= gettimeofday(tv,0); if (r) Tfailed("gettimeofday");
-
-  vb.used= 0;
-  if (!begin_set) {
-    Tvbf("gettimeofday= %ld.%06ld",tv->tv_sec,tv->tv_usec);
-    begin= *tv;
-    begin_set= 1;
-  } else {
-    diff.tv_sec= tv->tv_sec - begin.tv_sec;
-    diff.tv_usec= tv->tv_usec - begin.tv_usec;
-    if (diff.tv_usec < 0) {
-      diff.tv_sec -= 1;
-      diff.tv_usec += 1000000;
-    }
-    assert(diff.tv_sec >= 0);
-    assert(diff.tv_usec >= 0);
-    Tvbf("gettimeofday= +%ld.%06ld",diff.tv_sec,diff.tv_usec);
-  }
-  Rvb();
-  
-  return 0;
-}
-
-int Hselect(int n, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *to) {
-  int r;
-  
-  Qselect(n,rfds,wfds,efds,to);
-
-  r= select(n,rfds,wfds,efds,to);
-
-  if (r==-1) {
-    Rerrno("select");
-  } else {
-    vb.used= 0;
-    Tvbf("select= %d",r);
-    Tvbfdset(n,rfds);
-    Tvbfdset(n,wfds);
-    Tvbfdset(n,efds);
-    Rvb();
-  }
-
-  if (to) memset(to,0x5a,sizeof(*to));
-
-  return r;
-}
-
-int Hsocket(int domain, int type, int protocol) {
-  int r;
-  
-  assert(domain == AF_INET);
-
-  Qsocket(type);
-  r= socket(domain,type,protocol); if (r==-1) Tfailed("socket");
-
-  Rf("socket= %d",r);
-  return r;
-}
-
-int Hfcntl(int fd, int cmd, ...) {
-  long arg;
-  int r;
-  va_list al;
-
-  if (cmd == F_SETFL) {
-    va_start(al,cmd);
-    arg= va_arg(al,long);
-    va_end(al);
-    Qfcntl_setfl(fd,cmd,arg);
-    r= fcntl(fd, cmd, arg);
-  } else {
-    Qfcntl_other(fd,cmd);
-    r= fcntl(fd, cmd);
-  }
-
-  if (r==-1) Tfailed("fcntl");
-  Rf("fcntl= %d",r);
-  return r;
-}
-
-int Hconnect(int fd, struct sockaddr *addr, int addrlen) {
-  int r;
-  
-  Qconnect(fd,addr,addrlen);
-
-  r= connect(fd, addr, addrlen);
-
-  if (r) {
-    Rerrno("connect");
-  } else {
-    Rf("connect= ok");
-  }
-  return r;
-}
-
-int Hclose(int fd) {
-  Qclose(fd);
-  return 0;
-}
-
-int Hsendto(int fd, const void *msg, int msglen, unsigned int flags,
-	    const struct sockaddr *addr, int addrlen) {
-  int r;
-  
-  assert(!flags);
-  Qsendto(fd,msg,msglen,addr,addrlen);
-
-  r= sendto(fd,msg,msglen,flags,addr,addrlen);
-  if (r==-1) {
-    Rerrno("sendto");
-  } else {
-    Rf("sendto= %d",r);
-  }
-  return r;
-}
-
-int Hrecvfrom(int fd, void *buf, int buflen, unsigned int flags,
-	      struct sockaddr *addr, int *addrlen) {
-  int r;
-  
-  assert(!flags);
-  Qrecvfrom(fd,buflen,*addrlen);
-
-  r= recvfrom(fd,buf,buflen,flags,addr,addrlen);
-  if (r==-1) {
-    Rerrno("recvfrom");
-  } else {
-    vb.used= 0;
-    Tvbf("recvfrom= %d",r);
-    Tvbaddr(addr,*addrlen);
-    Tvbbytes(buf,r);
-    Rvb();
-  }
-
-  return r;
-}
-
-int Hread(int fd, void *buf, size_t len) {
-  int r;
-  
-  Qread(fd,len);
-
-  r= read(fd,buf,len);
-  if (r==-1) {
-    Rerrno("read");
-  } else {
-    vb.used= 0;
-    Tvba("read=");
-    Tvbbytes(buf,r);
-    Rvb();
-  }
-
-  return r;
-}
-
-int Hwrite(int fd, const void *buf, size_t len) {
-  int r;
-  
-  Qwrite(fd,buf,len);
-
-  r= write(fd,buf,len);
-  if (r==-1) {
-    Rerrno("write");
-  } else {
-    Rf("write= %d",r);
-  }
-  
-  return r;
-}
-
-
-
-
-
-
Index: adns/regress/m1test
diff -u adns/regress/m1test:1.5 adns/regress/m1test:1.6
--- adns/regress/m1test:1.5	Sat Apr 17 17:23:24 1999
+++ adns/regress/m1test	Sun Jul 11 20:11:08 1999
@@ -4,23 +4,28 @@
 
 if [ $# -lt 3 ]
 then
-	echo >&2 'usage: m1test <name> <initfile> <queryargs>'
+	echo >&2 'usage: m1test <name> <initfile> [<initflags>] <queryargs>'
 	exit 1
 fi
 
 case="case-$1"; shift
 initfile="$1"; shift
+
+case "$1" in
+-*)	initflags="$1"; shift
+esac
+
 queryargs="$*"
 
 initstring="`cat init-$initfile.text`"
 
-echo "$initfile" >"$case.sys"
+echo $initfile $initflags >"$case.sys"
 echo "$queryargs" >>"$case.sys"
 
-echo running "hrecord /... $queryargs"
+echo running hrecord $initflags "/... $queryargs"
 set +e
 ADNS_TEST_OUT_FD=3 3>>"$case.sys" >"$case.out" 2>"$case.err" </dev/null \
- ./hrecord "/$initstring" $queryargs
+ ./hrecord $initflags "/$initstring" $queryargs
 rc=$?
 set -e
 
Index: adns/regress/r1test
diff -u adns/regress/r1test:1.6 adns/regress/r1test:1.7
--- adns/regress/r1test:1.6	Wed May 12 22:33:38 1999
+++ adns/regress/r1test	Sun Jul 11 20:11:08 1999
@@ -7,7 +7,7 @@
 ocase="output-$casename"
 
 exec <"$case.sys"
-read initfile
+read initfile initflags
 read queryargs
 
 initstring="`cat init-$initfile.text`"
@@ -16,7 +16,7 @@
 
 set +e
 ADNS_TEST_REPORT_FD=3 3>>"$ocase.report" >"$ocase.out" 2>"$ocase.err" \
- ./hplayback "/$initstring" $queryargs
+ ./hplayback $initflags "/$initstring" $queryargs
 rc=$?
 set -e
 
Index: adns/src/adns.h
diff -u adns/src/adns.h:1.48 adns/src/adns.h:1.54
--- adns/src/adns.h:1.48	Sat Apr 17 16:41:16 1999
+++ adns/src/adns.h	Wed Jul 14 23:47:16 1999
@@ -19,11 +19,14 @@
  *  along with this program; if not, write to the Free Software Foundation,
  *  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- *  $Id: adns.h,v 1.48 1999/04/17 15:41:16 ian Exp $
+ *  $Id: adns.h,v 1.54 1999/07/14 22:47:16 ian Exp $
  */
 
 #ifndef ADNS_H_INCLUDED
 #define ADNS_H_INCLUDED
+#ifdef __cplusplus
+extern "C" { /* I really dislike this - iwj. */
+#endif
 
 #include <stdio.h>
 
@@ -91,15 +94,15 @@
   
 } adns_rrtype;
 
-/* In queries without qtf_quoteok_*, all domains must have standard
- * legal syntax.  In queries _with_ qtf_anyquote, domains in the query
- * or response may contain any characters, quoted according to
- * RFC1035 5.1.  On input to adns, the char* is a pointer to the
- * interior of a " delimited string, except that " may appear in it,
- * and on output, the char* is a pointer to a string which would be
- * legal either inside or outside " delimiters, and any characters
- * not usually legal in domain names will be quoted as \X
- * (if the character is 33-126 except \ and ") or \DDD.
+/* In queries without qf_quoteok_*, all domains must have standard
+ * legal syntax.  In queries _with_ qf_quoteok_*, domains in the query
+ * or response may contain any characters, quoted according to RFC1035
+ * 5.1.  On input to adns, the char* is a pointer to the interior of a
+ * " delimited string, except that " may appear in it, and on output,
+ * the char* is a pointer to a string which would be legal either
+ * inside or outside " delimiters, and any characters not usually
+ * legal in domain names will be quoted as \X (if the character is
+ * 33-126 except \ and ") or \DDD.
  *
  * Do not ask for _raw records containing mailboxes without
  * specifying _qf_anyquote.
@@ -111,6 +114,9 @@
   /* locally induced errors */
   adns_s_nomemory,
   adns_s_unknownrrtype,
+  adns_s_systemfail,
+
+  adns_s_max_localfail= 29,
   
   /* remotely induced errors, detected locally */
   adns_s_timeout,
@@ -118,6 +124,8 @@
   adns_s_norecurse,
   adns_s_invalidresponse,
   adns_s_unknownformat,
+
+  adns_s_max_remotefail= 59,
   
   /* remotely induced errors, reported by remote server to us */
   adns_s_rcodeservfail,
@@ -125,7 +133,7 @@
   adns_s_rcodenotimplemented,
   adns_s_rcoderefused,
   adns_s_rcodeunknown,
-  
+
   adns_s_max_tempfail= 99,
 
   /* remote configuration errors */
@@ -228,15 +236,25 @@
  *  If the call is successful, *query_io, *answer_r, and *context_r
  *  will all be set.
  * Errors:
- *  Return values are 0 or an errno value;
- *  Seriously fatal system errors (eg, failure to create sockets,
- *  malloc failure, etc.) return errno values;
- *  Other errors (nameserver failure, timed out connections, &c)
- *  are returned in the status field of the answer.  If status is
- *  nonzero then nrrs will be 0, otherwise it will be >0.
- *  type will always be the type requested;
- *  If no (appropriate) requests are done adns_check returns EWOULDBLOCK;
- *  If no (appropriate) requests are outstanding adns_query and adns_wait return ESRCH;
+ *  Return values are 0 or an errno value.
+ *
+ *  For _init, _init_strcfg, _submit and _synchronous, system errors
+ *  (eg, failure to create sockets, malloc failure, etc.) return errno
+ *  values.
+ * 
+ *  For _wait and _check failures are reported in the answer
+ *  structure, and only 0, ESRCH or (for _check) EWOULDBLOCK is
+ *  returned: if no (appropriate) requests are done adns_check returns
+ *  EWOULDBLOCK; if no (appropriate) requests are outstanding both
+ *  adns_query and adns_wait return ESRCH.
+ *
+ *  Additionally, _wait can return EINTR if you set adns_if_eintr.
+ *
+ *  All other errors (nameserver failure, timed out connections, &c)
+ *  are returned in the status field of the answer.  After a
+ *  successful _wait or _check, if status is nonzero then nrrs will be
+ *  0, otherwise it will be >0.  type will always be the type
+ *  requested.
  */
 
 int adns_init(adns_state *newstate_r, adns_initflags flags,
@@ -252,8 +270,8 @@
 		     adns_answer **answer_r);
 
 /* NB: if you set adns_if_noautosys then _submit and _check do not
- * make any system calls; you must use adns_callback (possibly after
- * adns_interest) to actually get things to happen.
+ * make any system calls; you must use some of the asynch-io event
+ * processing functions to actually get things to happen.
  */
 
 int adns_submit(adns_state ads,
@@ -274,37 +292,41 @@
 	      void **context_r);
 
 void adns_cancel(adns_query query);
+
+/* The adns_query you get back from _submit is valid (ie, can be
+ * legitimately passed into adns functions) until it is returned by
+ * adns_check or adns_wait, or passed to adns_cancel.  After that it
+ * must not be used.  You can rely on it not being reused until the
+ * first adns_submit or _transact call using the same adns_state after
+ * it became invalid, so you may compare it for equality with other
+ * query handles until you next call _query or _transact.
+ */
 
-void adns_finish(adns_state);
+void adns_finish(adns_state ads);
 /* You may call this even if you have queries outstanding;
  * they will be cancelled.
  */
+
 
-int adns_callback(adns_state, int maxfd, const fd_set *readfds, const fd_set *writefds,
-		  const fd_set *exceptfds);
-/* Gives adns flow-of-control for a bit.  This will never block.
- * If maxfd == -1 then adns will check (make nonblocking system calls on)
- * all of its own filedescriptors; otherwise it will only use those
- * < maxfd and specified in the fd_set's, as if select had returned them.
- * Other fd's may be in the fd_sets, and will be ignored.
- * _callback returns how many adns fd's were in the various sets, so
- * you can tell if your select handling code has missed something and is going awol.
- *
- * May also return -1 if a critical syscall failed, setting errno.
- */
-
-void adns_interest(adns_state, int *maxfd_io, fd_set *readfds_io,
-		   fd_set *writefds_io, fd_set *exceptfds_io,
-		   struct timeval **tv_mod, struct timeval *tv_buf);
-/* Find out file descriptors adns is interested in, and when it
- * would like the opportunity to time something out.  If you do not plan to
- * block then tv_mod may be 0.  Otherwise, tv_mod may point to 0 meaning
- * you have no timeout of your own, in which case tv_buf must be non-null and
- * _interest may fill it in and set *tv_mod=tv_buf.
- * readfds, writefds, exceptfds and maxfd may not be 0.
+void adns_forallqueries_begin(adns_state ads);
+adns_query adns_forallqueries_next(adns_state ads, void **context_r);
+/* Iterator functions, which you can use to loop over the outstanding
+ * (submitted but not yet successfuly checked/waited) queries.
+ *
+ * You can only have one iteration going at once.  You may call _begin
+ * at any time; after that, an iteration will be in progress.  You may
+ * only call _next when an iteration is in progress - anything else
+ * may coredump.  The iteration remains in progress until _next
+ * returns 0, indicating that all the queries have been walked over,
+ * or ANY other adns function is called with the same adns_state (or a
+ * query in the same adns_state).  There is no need to explicitly
+ * finish an iteration.
+ *
+ * context_r may be 0.  *context_r may not be set when _next returns 0.
  */
 
-/* Example expected/legal calling sequences:
+/*
+ * Example expected/legal calling sequence for submit/check/wait:
  *  adns_init
  *  adns_submit 1
  *  adns_submit 2
@@ -315,18 +337,200 @@
  *  adns_wait 3
  *  ....
  *  adns_finish
+ */
+
+/*
+ * Entrypoints for generic asynch io:
+ * (these entrypoints are not very useful except in combination with *
+ * some of the other I/O model calls which can tell you which fds to
+ * be interested in):
+ *
+ * Note that any adns call may cause adns to open and close fds, so
+ * you must call beforeselect or beforepoll again just before
+ * blocking, or you may not have an up-to-date list of it's fds.
+ */
+
+int adns_processany(adns_state ads);
+/* Gives adns flow-of-control for a bit.  This will never block, and
+ * can be used with any threading/asynch-io model.  If some error
+ * occurred which might cause an event loop to spin then the errno
+ * value is returned.
+ */
+
+int adns_processreadable(adns_state ads, int fd, const struct timeval *now);
+int adns_processwriteable(adns_state ads, int fd, const struct timeval *now);
+int adns_processexceptional(adns_state ads, int fd, const struct timeval *now);
+/* Gives adns flow-of-control so that it can process incoming data
+ * from, or send outgoing data via, fd.  Very like _processany.  If it
+ * returns zero then fd will no longer be readable or writeable
+ * (unless of course more data has arrived since).  adns will _only_
+ * that fd and only in the manner specified, regardless of whether
+ * adns_if_noautosys was specified.
+ *
+ * adns_processexceptional should be called when select(2) reports an
+ * exceptional condition, or poll(2) reports POLLPRI.
+ *
+ * It is fine to call _processreabable or _processwriteable when the
+ * fd is not ready, or with an fd that doesn't belong to adns; it will
+ * then just return 0.
+ *
+ * If some error occurred which might prevent an event loop to spin
+ * then the errno value is returned.
+ */
+
+void adns_processtimeouts(adns_state ads, const struct timeval *now);
+/* Gives adns flow-of-control so that it can process any timeouts
+ * which might have happened.  Very like _processreadable/writeable.
+ *
+ * now may be 0; if it isn't, *now must be the current time, recently
+ * obtained from gettimeofday.
+ */
+
+void adns_firsttimeout(adns_state ads,
+		       struct timeval **tv_mod, struct timeval *tv_buf,
+		       struct timeval now);
+/* Asks adns when it would first like the opportunity to time
+ * something out.  now must be the current time, from gettimeofday.
+ * 
+ * If tv_mod points to 0 then tv_buf must be non-null, and
+ * _firsttimeout will fill in *tv_buf with the time until the first
+ * timeout, and make *tv_mod point to tv_buf.  If adns doesn't have
+ * anything that might need timing out it will leave *tv_mod as 0.
+ *
+ * If *tv_mod is not 0 then tv_buf is not used.  adns will update
+ * *tv_mod if it has any earlier timeout, and leave it alone if it
+ * doesn't.
+ *
+ * This call will not actually do any I/O, or change the fds that adns
+ * is using.  It always succeeds and never blocks.
+ */
+
+void adns_globalsystemfailure(adns_state ads);
+/* If serious problem(s) happen which globally affect your ability to
+ * interact properly with adns, or adns's ability to function
+ * properly, you or adns can call this function.
  *
+ * All currently outstanding queries will be made to fail with
+ * adns_s_systemfail, and adns will close any stream sockets it has
+ * open.
+ *
+ * This is used by adns, for example, if gettimeofday() fails.
+ * Without this the program's event loop might start to spin !
+ *
+ * This call will never block.
+ */
+
+/*
+ * Entrypoints for select-loop based asynch io:
+ */
+
+void adns_beforeselect(adns_state ads, int *maxfd, fd_set *readfds,
+		       fd_set *writefds, fd_set *exceptfds,
+		       struct timeval **tv_mod, struct timeval *tv_buf,
+		       const struct timeval *now);
+/* Find out file descriptors adns is interested in, and when it would
+ * like the opportunity to time something out.  If you do not plan to
+ * block then tv_mod may be 0.  Otherwise, tv_mod and tv_buf are as
+ * for adns_firsttimeout.  readfds, writefds, exceptfds and maxfd_io may
+ * not be 0.
+ *
+ * If *now is not 0 then this will never actually do any I/O, or
+ * change the fds that adns is using or the timeouts it wants.  In any
+ * case it won't block.
+ */
+
+void adns_afterselect(adns_state ads, int maxfd, const fd_set *readfds,
+		      const fd_set *writefds, const fd_set *exceptfds,
+		      const struct timeval *now);
+/* Gives adns flow-of-control for a bit; intended for use after
+ * select.  This is just a fancy way of calling adns_processreadable/
+ * writeable/timeouts as appropriate, as if select had returned the
+ * data being passed.  Always succeeds.
+ */
+
+/*
+ * Example calling sequence:
+ *
  *  adns_init _noautosys
  *  loop {
- *   adns_interest
+ *   adns_beforeselect
  *   select
- *   adns_callback
+ *   adns_afterselect
  *   ...
  *   adns_submit / adns_check
  *   ...
  *  }
  */
 
+/*
+ * Entrypoints for poll-loop based asynch io:
+ */
+
+struct pollfd;
+/* In case your system doesn't have it or you forgot to include
+ * <sys/poll.h>, to stop the following declarations from causing
+ * problems.  If your system doesn't have poll then the following
+ * entrypoints will not be defined in libadns.  Sorry !
+ */
+
+int adns_beforepoll(adns_state ads, struct pollfd *fds, int *nfds_io, int *timeout_io,
+		    const struct timeval *now);
+/* Finds out which fd's adns is interested in, and when it would like
+ * to be able to time things out.  This is in a form suitable for use
+ * with poll(2).
+ * 
+ * On entry, usually fds should point to at least *nfds_io structs.
+ * adns will fill up to that many structs will information for poll,
+ * and record in *nfds_io how many structs it filled.  If it wants to
+ * listen for more structs then *nfds_io will be set to the number
+ * required and _beforepoll will return ERANGE.
+ *
+ * You may call _beforepoll with fds==0 and *nfds_io 0, in which case
+ * adns will fill in the number of fds that it might be interested in
+ * in *nfds_io, and always return either 0 (if it is not interested in
+ * any fds) or ERANGE (if it is).
+ *
+ * NOTE that (unless timeout_io is 0) adns may acquire additional fds
+ * from one call to the next, so you must put adns_beforepoll in a
+ * loop, rather than assuming that the second call (with the buffer
+ * size requested by the first) will not return ERANGE.
+ *
+ * adns only ever sets POLLIN, POLLOUT and POLLPRI in its pollfd
+ * structs, and only ever looks at those bits.  POLLPRI is required to
+ * detect TCP Urgent Data (which should not be used by a DNS server)
+ * so that adns can know that the TCP stream is now useless.
+ *
+ * In any case, *timeout_io should be a timeout value as for poll(2),
+ * which adns will modify downwards as required.  If the caller does
+ * not plan to block then *timeout_io should be 0 on entry, or
+ * alternatively, timeout_io may be 0.  (Alternatively, the caller may
+ * use _beforeselect with timeout_io==0 to find out about file
+ * descriptors, and use _firsttimeout is used to find out when adns
+ * might want to time something out.)
+ *
+ * adns_beforepoll will return 0 on success, and will not fail for any
+ * reason other than the fds buffer being too small (ERANGE).
+ *
+ * This call will never actually do any I/O, or change the fds that
+ * adns is using or the timeouts it wants; and in any case it won't
+ * block.
+ */
+
+#define ADNS_POLLFDS_RECOMMENDED 2
+/* If you allocate an fds buf with at least RECOMMENDED entries then
+ * you are unlikely to need to enlarge it.  You are recommended to do
+ * so if it's convenient.  However, you must be prepared for adns to
+ * require more space than this.
+ */
+
+void adns_afterpoll(adns_state ads, const struct pollfd *fds, int nfds,
+		    const struct timeval *now);
+/* Gives adns flow-of-control for a bit; intended for use after
+ * poll(2).  fds and nfds should be the results from poll().  pollfd
+ * structs mentioning fds not belonging to adns will be ignored.
+ */
+
+
 adns_status adns_rr_info(adns_rrtype type,
 			 const char **rrtname_r, const char **fmtname_r,
 			 int *len_r,
@@ -356,5 +560,14 @@
  */
 
 const char *adns_strerror(adns_status st);
+const char *adns_errabbrev(adns_status st);
+/* Like strerror but for adns_status values.  adns_errabbrev returns
+ * the abbreviation of the error - eg, for adns_s_timeout it returns
+ * "timeout".  You MUST NOT call these functions with status values
+ * not returned by the same adns library.
+ */
 
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
 #endif
Index: adns/src/adns.make
diff -u adns/src/adns.make:1.2 adns/src/adns.make:1.3
--- adns/src/adns.make:1.2	Tue Mar 30 19:57:19 1999
+++ adns/src/adns.make	Mon Jul  5 02:51:05 1999
@@ -16,4 +16,5 @@
 #  along with this program; if not, write to the Free Software Foundation,
 #  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
 
-LIBOBJS=	types.o event.o query.o reply.o general.o setup.o transmit.o parse.o
+LIBOBJS=	types.o event.o query.o reply.o general.o setup.o transmit.o \
+		parse.o poll.o
Index: adns/src/config.h.in
diff -u adns/src/config.h.in:1.2 adns/src/config.h.in:1.3
--- adns/src/config.h.in:1.2	Sun May  9 16:21:38 1999
+++ adns/src/config.h.in	Mon Jul  5 02:51:05 1999
@@ -12,6 +12,9 @@
 /* Define if printf-format argument lists a la GCC are available.  */
 #undef HAVE_GNUC25_PRINTFFORMAT
 
+/* Define if you have the poll function.  */
+#undef HAVE_POLL
+
 /* Define if you have the nsl library (-lnsl).  */
 #undef HAVE_LIBNSL
 
@@ -19,6 +22,15 @@
 #undef HAVE_LIBSOCKET
 
 /* Use the definitions: */
+
+#ifdef HAVE_POLL
+#include <sys/poll.h>
+#else
+struct pollfd { int fd; short events; short revents; };
+#define POLLIN  1
+#define POLLPRI 2
+#define POLLOUT 4
+#endif
 
 /* GNU C attributes. */
 #ifndef FUNCATTR
Index: adns/src/event.c
diff -u adns/src/event.c:1.21 adns/src/event.c:1.25
--- adns/src/event.c:1.21	Sat May  8 17:15:31 1999
+++ adns/src/event.c	Wed Jul 14 23:45:08 1999
@@ -36,8 +36,18 @@
 
 #include "internal.h"
 
-/* TCP connection management */
+/* TCP connection management. */
 
+void adns__tcp_closenext(adns_state ads) {
+  int serv;
+  
+  serv= ads->tcpserver;
+  close(ads->tcpsocket);
+  ads->tcpstate= server_disconnected;
+  ads->tcprecv.used= ads->tcpsend.used= 0;
+  ads->tcpserver= (serv+1)%ads->nservers;
+}
+
 void adns__tcp_broken(adns_state ads, const char *what, const char *why) {
   int serv;
   adns_query qu, nqu;
@@ -45,8 +55,7 @@
   assert(ads->tcpstate == server_connecting || ads->tcpstate == server_ok);
   serv= ads->tcpserver;
   adns__warn(ads,serv,0,"TCP connection lost: %s: %s",what,why);
-  close(ads->tcpsocket);
-  ads->tcpstate= server_disconnected;
+  adns__tcp_closenext(ads);
   
   for (qu= ads->timew.head; qu; qu= nqu) {
     nqu= qu->next;
@@ -59,9 +68,6 @@
       adns__query_fail(qu,adns_s_allservfail);
     }
   }
-
-  ads->tcprecv.used= ads->tcpsend.used= 0;
-  ads->tcpserver= (serv+1)%ads->nservers;
 }
 
 static void tcp_connected(adns_state ads, struct timeval now) {
@@ -114,9 +120,20 @@
   }
 }
 
-/* `Interest' functions - find out which fd's we might be interested in,
- * and when we want to be called back for a timeout.
- */
+/* Timeout handling functions. */
+
+void adns__must_gettimeofday(adns_state ads, const struct timeval **now_io,
+			     struct timeval *tv_buf) {
+  const struct timeval *now;
+  int r;
+
+  now= *now_io;
+  if (now) return;
+  r= gettimeofday(tv_buf,0); if (!r) { *now_io= tv_buf; return; }
+  adns__diag(ads,-1,0,"gettimeofday failed: %s",strerror(errno));
+  adns_globalsystemfailure(ads);
+  return;
+}
 
 static void inter_maxto(struct timeval **tv_io, struct timeval *tvbuf,
 			struct timeval maxto) {
@@ -148,175 +165,131 @@
   if (maxtime.tv_sec<0) timerclear(&maxtime);
   inter_maxto(tv_io,tvbuf,maxtime);
 }
-
-static void inter_addfd(int *maxfd, fd_set *fds, int fd) {
-  if (!maxfd || !fds) return;
-  if (fd>=*maxfd) *maxfd= fd+1;
-  FD_SET(fd,fds);
-}
 
-static void checktimeouts(adns_state ads, struct timeval now,
-			  struct timeval **tv_io, struct timeval *tvbuf) {
+void adns__timeouts(adns_state ads, int act,
+		    struct timeval **tv_io, struct timeval *tvbuf,
+		    struct timeval now) {
   adns_query qu, nqu;
-  
+
   for (qu= ads->timew.head; qu; qu= nqu) {
     nqu= qu->next;
-    if (timercmp(&now,&qu->timeout,>)) {
+    if (timercmp(&now,&qu->timeout,<=)) {
+      if (!tv_io) continue;
+      inter_maxtoabs(tv_io,tvbuf,now,qu->timeout);
+    } else {
+      if (!act) continue;
       LIST_UNLINK(ads->timew,qu);
       if (qu->state != query_udp) {
 	adns__query_fail(qu,adns_s_timeout);
       } else {
 	adns__query_udp(qu,now);
       }
-    } else {
-      inter_maxtoabs(tv_io,tvbuf,now,qu->timeout);
+      nqu= ads->timew.head;
     }
   }
 }  
- 
-void adns_interest(adns_state ads, int *maxfd,
-		   fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
-		   struct timeval **tv_io, struct timeval *tvbuf) {
-  struct timeval now;
-  struct timeval tvto_lr;
-  int r;
-  
-/*fprintf(stderr,"adns_interest\n");*/
 
-  r= gettimeofday(&now,0);
-  if (r) {
-    adns__warn(ads,-1,0,"gettimeofday failed - will sleep for a bit: %s",
-	       strerror(errno));
-    timerclear(&tvto_lr); timevaladd(&tvto_lr,LOCALRESOURCEMS);
-    inter_maxto(tv_io, tvbuf, tvto_lr);
-  } else {
-    checktimeouts(ads,now,tv_io,tvbuf);
-  }
-  
-  inter_addfd(maxfd,readfds,ads->udpsocket);
+void adns_firsttimeout(adns_state ads,
+		       struct timeval **tv_io, struct timeval *tvbuf,
+		       struct timeval now) {
+  adns__timeouts(ads, 0, tv_io,tvbuf, now);
+}
 
+void adns_processtimeouts(adns_state ads, const struct timeval *now) {
+  struct timeval tv_buf;
+
+  adns__must_gettimeofday(ads,&now,&tv_buf); if (!now) return;
+  adns__timeouts(ads, 1, 0,0, *now);
+}
+
+/* fd handling functions.  These are the top-level of the real work of
+ * reception and often transmission.
+ */
+
+int adns__pollfds(adns_state ads, struct pollfd pollfds_buf[MAX_POLLFDS]) {
+  /* Returns the number of entries filled in.  Always zeroes revents. */
+
+  assert(MAX_POLLFDS==2);
+
+  pollfds_buf[0].fd= ads->udpsocket;
+  pollfds_buf[0].events= POLLIN;
+  pollfds_buf[0].revents= 0;
+
   switch (ads->tcpstate) {
   case server_disconnected:
-    break;
+    return 1;
   case server_connecting:
-    inter_addfd(maxfd,writefds,ads->tcpsocket);
+    pollfds_buf[1].events= POLLOUT;
     break;
   case server_ok:
-    inter_addfd(maxfd,readfds,ads->tcpsocket);
-    inter_addfd(maxfd,exceptfds,ads->tcpsocket);
-    if (ads->tcpsend.used) inter_addfd(maxfd,writefds,ads->tcpsocket);
+    pollfds_buf[1].events= ads->tcpsend.used ? POLLIN|POLLOUT|POLLPRI : POLLIN|POLLPRI;
     break;
   default:
     abort();
   }
+  pollfds_buf[1].fd= ads->tcpsocket;
+  return 2;
 }
 
-/* Callback procedures - these do the real work of reception and timeout, etc. */
-
-static int callb_checkfd(int maxfd, const fd_set *fds, int fd) {
-  return maxfd<0 || !fds ? 1 :
-         fd<maxfd && FD_ISSET(fd,fds);
-}
-
-static int internal_callback(adns_state ads, int maxfd,
-			     const fd_set *readfds, const fd_set *writefds,
-			     const fd_set *exceptfds,
-			     struct timeval now) {
-  int skip, want, dgramlen, count, udpaddrlen, r, serv;
+int adns_processreadable(adns_state ads, int fd, const struct timeval *now) {
+  int skip, want, dgramlen, r, udpaddrlen, serv;
   byte udpbuf[DNS_MAXUDP];
   struct sockaddr_in udpaddr;
-
-  count= 0;
-
+  
   switch (ads->tcpstate) {
   case server_disconnected:
-    break;
   case server_connecting:
-    if (callb_checkfd(maxfd,writefds,ads->tcpsocket)) {
-      count++;
-      assert(ads->tcprecv.used==0);
-      if (!adns__vbuf_ensure(&ads->tcprecv,1)) return -1;
-      if (ads->tcprecv.buf) {
-	r= read(ads->tcpsocket,&ads->tcprecv.buf,1);
-	if (r==0 || (r<0 && (errno==EAGAIN || errno==EWOULDBLOCK))) {
-	  tcp_connected(ads,now);
-	} else if (r>0) {
-	  adns__tcp_broken(ads,"connect/read","sent data before first request");
-	} else if (errno!=EINTR) {
-	  adns__tcp_broken(ads,"connect/read",strerror(errno));
-	}
-      }
-    }
     break;
   case server_ok:
-    count+= callb_checkfd(maxfd,readfds,ads->tcpsocket) +
-            callb_checkfd(maxfd,exceptfds,ads->tcpsocket) +
-      (ads->tcpsend.used && callb_checkfd(maxfd,writefds,ads->tcpsocket));
-    if (callb_checkfd(maxfd,readfds,ads->tcpsocket)) {
-      skip= 0;
-      for (;;) {
-	if (ads->tcprecv.used<skip+2) {
-	  want= 2;
-	} else {
-	  dgramlen= (ads->tcprecv.buf[skip]<<8) | ads->tcprecv.buf[skip+1];
-	  if (ads->tcprecv.used<skip+2+dgramlen) {
-	    want= 2+dgramlen;
-	  } else {
-	    adns__procdgram(ads,ads->tcprecv.buf+skip+2,dgramlen,ads->tcpserver,now);
-	    skip+= 2+dgramlen; continue;
-	  }
-	}
-	ads->tcprecv.used -= skip;
-	memmove(ads->tcprecv.buf,ads->tcprecv.buf+skip,ads->tcprecv.used);
-	skip= 0;
-	if (!adns__vbuf_ensure(&ads->tcprecv,want)) return -1;
-	assert(ads->tcprecv.used <= ads->tcprecv.avail);
-	if (ads->tcprecv.used == ads->tcprecv.avail) continue;
-	r= read(ads->tcpsocket,
-		ads->tcprecv.buf+ads->tcprecv.used,
-		ads->tcprecv.avail-ads->tcprecv.used);
-	if (r>0) {
-	  ads->tcprecv.used+= r;
+    if (fd != ads->tcpsocket) break;
+    skip= 0;
+    for (;;) {
+      if (ads->tcprecv.used<skip+2) {
+	want= 2;
+      } else {
+	dgramlen= (ads->tcprecv.buf[skip]<<8) | ads->tcprecv.buf[skip+1];
+	if (ads->tcprecv.used<skip+2+dgramlen) {
+	  want= 2+dgramlen;
 	} else {
-	  if (r<0) {
-	    if (errno==EAGAIN || errno==EWOULDBLOCK || errno==ENOMEM) break;
-	    if (errno==EINTR) continue;
-	  }
-	  adns__tcp_broken(ads,"read",r?strerror(errno):"closed");
-	  break;
+	  adns__procdgram(ads,ads->tcprecv.buf+skip+2,dgramlen,ads->tcpserver,*now);
+	  skip+= 2+dgramlen; continue;
 	}
       }
-    } else if (callb_checkfd(maxfd,exceptfds,ads->tcpsocket)) {
-      adns__tcp_broken(ads,"select","exceptional condition detected");
-    } else if (ads->tcpsend.used && callb_checkfd(maxfd,writefds,ads->tcpsocket)) {
-      adns__sigpipe_protect(ads);
-      r= write(ads->tcpsocket,ads->tcpsend.buf,ads->tcpsend.used);
-      adns__sigpipe_unprotect(ads);
-      if (r<0) {
-	if (errno!=EAGAIN && errno!=EWOULDBLOCK && errno!=ENOMEM && errno!=EINTR) {
-	  adns__tcp_broken(ads,"write",strerror(errno));
+      ads->tcprecv.used -= skip;
+      memmove(ads->tcprecv.buf,ads->tcprecv.buf+skip,ads->tcprecv.used);
+      skip= 0;
+      if (!adns__vbuf_ensure(&ads->tcprecv,want)) return ENOMEM;
+      assert(ads->tcprecv.used <= ads->tcprecv.avail);
+      if (ads->tcprecv.used == ads->tcprecv.avail) continue;
+      r= read(ads->tcpsocket,
+	      ads->tcprecv.buf+ads->tcprecv.used,
+	      ads->tcprecv.avail-ads->tcprecv.used);
+      if (r>0) {
+	ads->tcprecv.used+= r;
+      } else {
+	if (r) {
+	  if (errno==EAGAIN || errno==EWOULDBLOCK) return 0;
+	  if (errno==EINTR) continue;
+	  if (errno_resources(errno)) return errno;
 	}
-      } else if (r>0) {
-	ads->tcpsend.used -= r;
-	memmove(ads->tcpsend.buf,ads->tcpsend.buf+r,ads->tcpsend.used);
+	adns__tcp_broken(ads,"read",r?strerror(errno):"closed");
+	return 0;
       }
-    }
-    break;
+    } /* never reached */
   default:
     abort();
   }
-
-  if (callb_checkfd(maxfd,readfds,ads->udpsocket)) {
-    count++;
+  if (fd == ads->udpsocket) {
     for (;;) {
       udpaddrlen= sizeof(udpaddr);
       r= recvfrom(ads->udpsocket,udpbuf,sizeof(udpbuf),0,
 		  (struct sockaddr*)&udpaddr,&udpaddrlen);
       if (r<0) {
-	if (!(errno == EAGAIN || errno == EWOULDBLOCK ||
-	      errno == EINTR || errno == ENOMEM || errno == ENOBUFS))
-	  adns__warn(ads,-1,0,"datagram receive error: %s",strerror(errno));
-	break;
+	if (errno == EAGAIN || errno == EWOULDBLOCK) return 0;
+	if (errno == EINTR) continue;
+	if (errno_resources(errno)) return errno;
+	adns__warn(ads,-1,0,"datagram receive error: %s",strerror(errno));
+	return 0;
       }
       if (udpaddrlen != sizeof(udpaddr)) {
 	adns__diag(ads,-1,0,"datagram received with wrong address length %d"
@@ -342,28 +315,199 @@
 		   inet_ntoa(udpaddr.sin_addr));
 	continue;
       }
-      adns__procdgram(ads,udpbuf,r,serv,now);
+      adns__procdgram(ads,udpbuf,r,serv,*now);
     }
   }
-  return count;
+  return 0;
 }
 
-int adns_callback(adns_state ads, int maxfd,
-		  const fd_set *readfds, const fd_set *writefds,
-		  const fd_set *exceptfds) {
-  struct timeval now;
+int adns_processwriteable(adns_state ads, int fd, const struct timeval *now) {
   int r;
+  
+  switch (ads->tcpstate) {
+  case server_disconnected:
+    break;
+  case server_connecting:
+    if (fd != ads->tcpsocket) break;
+    assert(ads->tcprecv.used==0);
+    for (;;) {
+      if (!adns__vbuf_ensure(&ads->tcprecv,1)) return ENOMEM;
+      r= read(ads->tcpsocket,&ads->tcprecv.buf,1);
+      if (r==0 || (r<0 && (errno==EAGAIN || errno==EWOULDBLOCK))) {
+	tcp_connected(ads,*now);
+	return 0;
+      }
+      if (r>0) {
+	adns__tcp_broken(ads,"connect/read","sent data before first request");
+	return 0;
+      }
+      if (errno==EINTR) continue;
+      if (errno_resources(errno)) return errno;
+      adns__tcp_broken(ads,"connect/read",strerror(errno));
+      return 0;
+    } /* not reached */
+  case server_ok:
+    if (!(ads->tcpsend.used && fd == ads->tcpsocket)) break;
+    for (;;) {
+      adns__sigpipe_protect(ads);
+      r= write(ads->tcpsocket,ads->tcpsend.buf,ads->tcpsend.used);
+      adns__sigpipe_unprotect(ads);
+      if (r<0) {
+	if (errno==EINTR) continue;
+	if (errno==EAGAIN || errno==EWOULDBLOCK) return 0;
+	if (errno_resources(errno)) return errno;
+	adns__tcp_broken(ads,"write",strerror(errno));
+	return 0;
+      } else if (r>0) {
+	ads->tcpsend.used -= r;
+	memmove(ads->tcpsend.buf,ads->tcpsend.buf+r,ads->tcpsend.used);
+      }
+    } /* not reached */
+  default:
+    abort();
+  }
+  return 0;
+}
+  
+int adns_processexceptional(adns_state ads, int fd, const struct timeval *now) {
+  switch (ads->tcpstate) {
+  case server_disconnected:
+    break;
+  case server_connecting:
+  case server_ok:
+    if (fd != ads->tcpsocket) break;
+    adns__tcp_broken(ads,"poll/select","exceptional condition detected");
+    return 0;
+  default:
+    abort();
+  }
+  return 0;
+}
 
-  r= gettimeofday(&now,0); if (r) return -1;
-  checktimeouts(ads,now,0,0);
-  return internal_callback(ads,maxfd,readfds,writefds,exceptfds,now);
+static void fd_event(adns_state ads, int fd,
+		     int revent, int pollflag,
+		     int maxfd, const fd_set *fds,
+		     int (*func)(adns_state, int fd, const struct timeval *now),
+		     struct timeval now, int *r_r) {
+  int r;
+  
+  if (!(revent & pollflag)) return;
+  if (fds && !(fd<maxfd && FD_ISSET(fd,fds))) return;
+  r= func(ads,fd,&now);
+  if (r) {
+    if (r_r) {
+      *r_r= r;
+    } else {
+      adns__diag(ads,-1,0,"process fd failed after select: %s",strerror(errno));
+      adns_globalsystemfailure(ads);
+    }
+  }
 }
 
-/* User-visible functions and their implementation. */
+void adns__fdevents(adns_state ads,
+		    const struct pollfd *pollfds, int npollfds,
+		    int maxfd, const fd_set *readfds,
+		    const fd_set *writefds, const fd_set *exceptfds,
+		    struct timeval now, int *r_r) {
+  int i, fd, revents;
+
+  for (i=0; i<npollfds; i++) {
+    fd= pollfds[i].fd;
+    if (fd >= maxfd) maxfd= fd+1;
+    revents= pollfds[i].revents;
+    fd_event(ads,fd, revents,POLLIN, maxfd,readfds, adns_processreadable,now,r_r);
+    fd_event(ads,fd, revents,POLLOUT, maxfd,writefds, adns_processwriteable,now,r_r);
+    fd_event(ads,fd, revents,POLLPRI, maxfd,exceptfds, adns_processexceptional,now,r_r);
+  }
+}
 
+/* Wrappers for select(2). */
+
+void adns_beforeselect(adns_state ads, int *maxfd_io, fd_set *readfds_io,
+		       fd_set *writefds_io, fd_set *exceptfds_io,
+		       struct timeval **tv_mod, struct timeval *tv_tobuf,
+		       const struct timeval *now) {
+  struct timeval tv_nowbuf;
+  struct pollfd pollfds[MAX_POLLFDS];
+  int i, fd, maxfd, npollfds;
+  
+  if (tv_mod && (!*tv_mod || (*tv_mod)->tv_sec || (*tv_mod)->tv_usec)) {
+    /* The caller is planning to sleep. */
+    adns__must_gettimeofday(ads,&now,&tv_nowbuf);
+    if (!now) return;
+    adns__timeouts(ads, 1, tv_mod,tv_tobuf, *now);
+  }
+
+  npollfds= adns__pollfds(ads,pollfds);
+  maxfd= *maxfd_io;
+  for (i=0; i<npollfds; i++) {
+    fd= pollfds[i].fd;
+    if (fd >= maxfd) maxfd= fd+1;
+    if (pollfds[i].events & POLLIN) FD_SET(fd,readfds_io);
+    if (pollfds[i].events & POLLOUT) FD_SET(fd,writefds_io);
+    if (pollfds[i].events & POLLPRI) FD_SET(fd,exceptfds_io);
+  }
+  *maxfd_io= maxfd;
+}
+
+void adns_afterselect(adns_state ads, int maxfd, const fd_set *readfds,
+		      const fd_set *writefds, const fd_set *exceptfds,
+		      const struct timeval *now) {
+  struct timeval tv_buf;
+  struct pollfd pollfds[MAX_POLLFDS];
+  int npollfds, i;
+
+  adns__must_gettimeofday(ads,&now,&tv_buf);
+  if (!now) return;
+  adns_processtimeouts(ads,now);
+
+  npollfds= adns__pollfds(ads,pollfds);
+  for (i=0; i<npollfds; i++) pollfds[i].revents= POLLIN|POLLOUT|POLLPRI;
+  adns__fdevents(ads,
+		 pollfds,npollfds,
+		 maxfd,readfds,writefds,exceptfds,
+		 *now, 0);
+}
+
+/* General helpful functions. */
+
+void adns_globalsystemfailure(adns_state ads) {
+  while (ads->timew.head) {
+    adns__query_fail(ads->timew.head, adns_s_systemfail);
+  }
+  
+  switch (ads->tcpstate) {
+  case server_connecting:
+  case server_ok:
+    adns__tcp_closenext(ads);
+    break;
+  case server_disconnected:
+    break;
+  default:
+    abort();
+  }
+}
+
+int adns_processany(adns_state ads) {
+  int r;
+  struct timeval now;
+  struct pollfd pollfds[MAX_POLLFDS];
+  int npollfds;
+
+  r= gettimeofday(&now,0);
+  if (!r) adns_processtimeouts(ads,&now);
+
+  npollfds= adns__pollfds(ads,pollfds);
+  adns__fdevents(ads,
+		 pollfds,npollfds,
+		 0,0,0,0,
+		 now,&r);
+  return r;
+}
+
 void adns__autosys(adns_state ads, struct timeval now) {
   if (ads->iflags & adns_if_noautosys) return;
-  adns_callback(ads,-1,0,0,0);
+  adns_processany(ads);
 }
 
 static int internal_check(adns_state ads,
@@ -382,6 +526,7 @@
   LIST_UNLINK(ads->output,qu);
   *answer= qu->answer;
   if (context_r) *context_r= qu->ctx.ext;
+  *query_io= qu;
   free(qu);
   return 0;
 }
@@ -390,7 +535,7 @@
 	      adns_query *query_io,
 	      adns_answer **answer_r,
 	      void **context_r) {
-  int r, maxfd, rsel, rcb;
+  int r, maxfd, rsel;
   fd_set readfds, writefds, exceptfds;
   struct timeval tvbuf, *tvp;
   
@@ -399,14 +544,19 @@
     if (r != EWOULDBLOCK) return r;
     maxfd= 0; tvp= 0;
     FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptfds);
-    adns_interest(ads,&maxfd,&readfds,&writefds,&exceptfds,&tvp,&tvbuf);
+    adns_beforeselect(ads,&maxfd,&readfds,&writefds,&exceptfds,&tvp,&tvbuf,0);
     rsel= select(maxfd,&readfds,&writefds,&exceptfds,tvp);
     if (rsel==-1) {
-      if (errno == EINTR && !(ads->iflags & adns_if_eintr)) continue;
-      return errno;
+      if (errno == EINTR) {
+	if (ads->iflags & adns_if_eintr) return EINTR;
+      } else {
+	adns__diag(ads,-1,0,"select failed in wait: %s",strerror(errno));
+	adns_globalsystemfailure(ads);
+      }
+    } else {
+      assert(rsel >= 0);
+      adns_afterselect(ads,maxfd,&readfds,&writefds,&exceptfds,0);
     }
-    rcb= adns_callback(ads,maxfd,&readfds,&writefds,&exceptfds);
-    assert(rcb==rsel);
   }
 }
 
@@ -416,8 +566,9 @@
 	       void **context_r) {
   struct timeval now;
   int r;
+  
+  r= gettimeofday(&now,0);
+  if (!r) adns__autosys(ads,now);
   
-  r= gettimeofday(&now,0); if (r) return errno;
-  adns__autosys(ads,now);
   return internal_check(ads,query_io,answer_r,context_r);
 }
Index: adns/src/general.c
diff -u adns/src/general.c:1.17 adns/src/general.c:1.18
--- adns/src/general.c:1.17	Sat May  8 17:15:33 1999
+++ adns/src/general.c	Thu Jun 17 01:54:06 1999
@@ -200,10 +200,11 @@
   return st;
 }
 
-#define SINFO(n,s) { adns_s_##n, s }
+#define SINFO(n,s) { adns_s_##n, #n, s }
 
 static const struct sinfo {
   adns_status st;
+  const char *abbrev;
   const char *string;
 } sinfos[]= {
   SINFO(  ok,                  "OK"                                            ),
@@ -244,16 +245,22 @@
   return *st < si->st ? -1 : *st > si->st ? 1 : 0;
 }
 
+static const struct sinfo *findsinfo(adns_status st) {
+  return bsearch(&st,sinfos,sizeof(sinfos)/sizeof(*sinfos),sizeof(*sinfos),si_compar);
+}
+
 const char *adns_strerror(adns_status st) {
-  static char buf[100];
+  const struct sinfo *si;
 
+  si= findsinfo(st);
+  return si->string;
+}
+
+const char *adns_errabbrev(adns_status st) {
   const struct sinfo *si;
 
-  si= bsearch(&st,sinfos,sizeof(sinfos)/sizeof(*si),sizeof(*si),si_compar);
-  if (si) return si->string;
-  
-  snprintf(buf,sizeof(buf),"code %d",st);
-  return buf;
+  si= findsinfo(st);
+  return si->abbrev;
 }
 
 void adns__isort(void *array, int nobjs, int sz, void *tempbuf,
Index: adns/src/internal.h
diff -u adns/src/internal.h:1.37 adns/src/internal.h:1.41
--- adns/src/internal.h:1.37	Sat Apr 17 15:38:52 1999
+++ adns/src/internal.h	Wed Jul 14 23:45:09 1999
@@ -32,6 +32,7 @@
 #include <assert.h>
 #include <unistd.h>
 #include <signal.h>
+#include <errno.h>
 
 #include <sys/time.h>
 
@@ -44,7 +45,6 @@
 #define UDPMAXRETRIES 15
 #define UDPRETRYMS 2000
 #define TCPMS 30000
-#define LOCALRESOURCEMS 20
 #define MAXTTLBELIEVE (7*86400) /* any TTL > 7 days is capped */
 
 #define DNS_PORT 53
@@ -56,6 +56,8 @@
 
 #define DNS_INADDR_ARPA "in-addr", "arpa"
 
+#define MAX_POLLFDS  ADNS_POLLFDS_RECOMMENDED
+
 typedef enum {
   rcode_noerror,
   rcode_formaterror,
@@ -156,7 +158,7 @@
   struct { allocnode *head, *tail; } allocations;
   int interim_allocd;
   void *final_allocspace;
-  
+
   const typeinfo *typei;
   byte *query_dgram;
   int query_dglen;
@@ -213,8 +215,11 @@
    *  tcpsent timew   null   >=0  irrelevant     zero        any
    *				  
    *  child   childw  set    >=0  irrelevant     irrelevant  irrelevant
+   *  child   NONE    null   >=0  irrelevant     irrelevant  irrelevant
    *  done    output  null   -1   irrelevant     irrelevant  irrelevant
    *
+   * Queries are only not on a queue when they are actually being processed.
+   *
    *			      +------------------------+
    *             START -----> |      udp/NONE          |
    *			      +------------------------+
@@ -259,6 +264,7 @@
   FILE *diagfile;
   int configerrno;
   struct { adns_query head, tail; } timew, childw, output;
+  adns_query forallnext;
   int nextid, udpsocket, tcpsocket;
   vbuf tcpsend, tcprecv;
   int nservers, nsortlist, nsearchlist, searchndots, tcpserver;
@@ -266,6 +272,7 @@
   struct timeval tcptimeout;
   struct sigaction stdsigpipe;
   sigset_t stdsigmask;
+  struct pollfd pollfds_buf[MAX_POLLFDS];
   struct server {
     struct in_addr addr;
   } servers[MAXSERVERS];
@@ -378,6 +385,17 @@
  * succeeds or fails (if it succeeds, the vbuf is reused for qu->vb).
  *
  * *ctx is copied byte-for-byte into the query.
+ *
+ * When the child query is done, ctx->callback will be called.  The
+ * child will already have been taken off both the global list of
+ * queries in ads and the list of children in the parent.  The child
+ * will be freed when the callback returns.  The parent will have been
+ * taken off the global childw queue iff this is the last child for
+ * that parent.  If there is no error detected in the callback, then
+ * it should call adns__query_done if and only if there are no more
+ * children (by checking parent->children.head).  If an error is
+ * detected in the callback it should call adns__query_fail and any
+ * remaining children will automatically be cancelled.
  */
 
 void adns__search_next(adns_state ads, adns_query qu, struct timeval now);
@@ -584,11 +602,24 @@
 /* From event.c: */
 
 void adns__tcp_broken(adns_state ads, const char *what, const char *why);
+void adns__tcp_closenext(adns_state ads);
 void adns__tcp_tryconnect(adns_state ads, struct timeval now);
 
 void adns__autosys(adns_state ads, struct timeval now);
 /* Make all the system calls we want to if the application wants us to. */
 
+void adns__must_gettimeofday(adns_state ads, const struct timeval **now_io,
+			     struct timeval *tv_buf);
+void adns__timeouts(adns_state ads, int act,
+		    struct timeval **tv_io, struct timeval *tvbuf,
+		    struct timeval now);
+int adns__pollfds(adns_state ads, struct pollfd pollfds_buf[MAX_POLLFDS]);
+void adns__fdevents(adns_state ads,
+		    const struct pollfd *pollfds, int npollfds,
+		    int maxfd, const fd_set *readfds,
+		    const fd_set *writefds, const fd_set *exceptfds,
+		    struct timeval now, int *r_r);
+
 /* Useful static inline functions: */
 
 static inline void timevaladd(struct timeval *tv_io, long ms) {
@@ -604,8 +635,10 @@
 static inline int ctype_whitespace(int c) { return c==' ' || c=='\n' || c=='\t'; }
 static inline int ctype_digit(int c) { return c>='0' && c<='9'; }
 static inline int ctype_alpha(int c) {
-  return (c >= 'a' && c <= 'z') || (c >= 'A' || c <= 'Z');
+  return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
 }
+
+static inline int errno_resources(int e) { return e==ENOMEM || e==ENOBUFS; }
 
 /* Useful macros */
 
Index: adns/src/poll.c
diff -u /dev/null adns/src/poll.c:1.2
--- /dev/null	Thu Jul 15 00:51:06 1999
+++ adns/src/poll.c	Sun Jul 11 19:15:17 1999
@@ -0,0 +1,85 @@
+/*
+ * poll.c
+ * - wrappers for poll(2)
+ */
+/*
+ *  This file is part of adns, which is Copyright (C) 1997-1999 Ian Jackson
+ *  
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software Foundation,
+ *  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
+ */
+
+#include <limits.h>
+
+#include "internal.h"
+
+#ifdef HAVE_POLL
+
+int adns_beforepoll(adns_state ads, struct pollfd *fds, int *nfds_io, int *timeout_io,
+		    const struct timeval *now) {
+  struct timeval tv_nowbuf, tv_tobuf, *tv_to;
+  int space, found, timeout_ms;
+  struct pollfd fds_tmp[MAX_POLLFDS];
+
+  if (timeout_io) {
+    adns__must_gettimeofday(ads,&now,&tv_nowbuf);
+    if (!now) { *nfds_io= 0; return 0; }
+
+    timeout_ms= *timeout_io;
+    if (timeout_ms == -1) {
+      tv_to= 0;
+    } else {
+      tv_tobuf.tv_sec= timeout_ms / 1000;
+      tv_tobuf.tv_usec= (timeout_ms % 1000)*1000;
+      tv_to= &tv_tobuf;
+    }
+
+    adns__timeouts(ads, 0, &tv_to,&tv_tobuf, *now);
+
+    if (tv_to) {
+      assert(tv_to == &tv_tobuf);
+      timeout_ms= (tv_tobuf.tv_usec+999)/1000;
+      assert(tv_tobuf.tv_sec < (INT_MAX-timeout_ms)/1000);
+      timeout_ms += tv_tobuf.tv_sec*1000;
+    } else {
+      timeout_ms= -1;
+    }
+    *timeout_io= timeout_ms;
+  }
+  
+  space= *nfds_io;
+  if (space >= MAX_POLLFDS) {
+    found= adns__pollfds(ads,fds);
+    *nfds_io= found;
+  } else {
+    found= adns__pollfds(ads,fds_tmp);
+    *nfds_io= found;
+    if (space < found) return ERANGE;
+    memcpy(fds,fds_tmp,sizeof(struct pollfd)*found);
+  }
+  return 0;
+}
+
+void adns_afterpoll(adns_state ads, const struct pollfd *fds, int nfds,
+		    const struct timeval *now) {
+  struct timeval tv_buf;
+
+  adns__must_gettimeofday(ads,&now,&tv_buf);
+  if (!now) return;
+
+  adns__timeouts(ads, 1, 0,0, *now);
+  adns__fdevents(ads, fds,nfds, 0,0,0,0, *now,0);
+}
+
+#endif
Index: adns/src/query.c
diff -u adns/src/query.c:1.34 adns/src/query.c:1.35
--- adns/src/query.c:1.34	Sat May  8 16:40:59 1999
+++ adns/src/query.c	Thu Jun 17 00:16:28 1999
@@ -437,6 +437,7 @@
   parent= qu->parent;
   if (parent) {
     LIST_UNLINK_PART(parent->children,qu,siblings.);
+    if (!parent->children.head) LIST_UNLINK(qu->ads->childw,parent);
     qu->ctx.callback(parent,qu);
     free_query_allocs(qu);
     free(qu);
Index: adns/src/setup.c
diff -u adns/src/setup.c:1.20 adns/src/setup.c:1.21
--- adns/src/setup.c:1.20	Sat May  8 16:41:01 1999
+++ adns/src/setup.c	Wed Jul 14 23:45:09 1999
@@ -444,6 +444,7 @@
   LIST_INIT(ads->timew);
   LIST_INIT(ads->childw);
   LIST_INIT(ads->output);
+  ads->forallnext= 0;
   ads->nextid= 0x311f;
   ads->udpsocket= ads->tcpsocket= -1;
   adns__vbuf_init(&ads->tcpsend);
@@ -564,4 +565,30 @@
   adns__vbuf_free(&ads->tcpsend);
   adns__vbuf_free(&ads->tcprecv);
   free(ads);
+}
+
+void adns_forallqueries_begin(adns_state ads) {
+  ads->forallnext=
+    ads->timew.head ? ads->timew.head :
+    ads->childw.head ? ads->childw.head :
+    ads->output.head;
+}
+  
+adns_query adns_forallqueries_next(adns_state ads, void **context_r) {
+  adns_query qu, nqu;
+
+  nqu= ads->forallnext;
+  for (;;) {
+    qu= nqu;
+    if (!qu) return 0;
+    nqu=
+      qu->next ? qu->next :
+      qu == ads->timew.tail ? (ads->childw.head ? ads->childw.head : ads->output.head) :
+      qu == ads->childw.tail ? ads->output.head :
+      0;
+    if (!qu->parent) break;
+  }
+  ads->forallnext= nqu;
+  if (context_r) *context_r= qu->ctx.ext;
+  return qu;
 }
Index: adns/src/types.c
diff -u adns/src/types.c:1.29 adns/src/types.c:1.30
--- adns/src/types.c:1.29	Wed May 12 23:00:07 1999
+++ adns/src/types.c	Thu Jun 17 01:54:06 1999
@@ -54,7 +54,7 @@
  * _strpair                   (mf,cs)
  * _intstrpair                (mf,cs)
  * _hinfo                     (pa)
- * _mailbox                   (pap)
+ * _mailbox                   (pap +pap_mailbox822)
  * _rp                        (pa)
  * _soa                       (pa,mf,cs)
  * _flat                      (mf)
@@ -791,8 +791,8 @@
  * _mailbox   (pap)
  */
 
-static adns_status pap_mailbox(const parseinfo *pai, int *cbyte_io, int max,
-			       char **mb_r) {
+static adns_status pap_mailbox822(const parseinfo *pai, int *cbyte_io, int max,
+				  char **mb_r) {
   int lablen, labstart, i, needquote, c, r, neednorm;
   const unsigned char *p;
   char *str;
@@ -845,6 +845,16 @@
   str[vb->used]= 0;
   *mb_r= str;
   return adns_s_ok;
+}
+
+static adns_status pap_mailbox(const parseinfo *pai, int *cbyte_io, int max,
+			       char **mb_r) {
+  if (pai->qu->typei->type & adns__qtf_mail822) {
+    return pap_mailbox822(pai, cbyte_io, max, mb_r);
+  } else {
+    return pap_domain(pai, cbyte_io, max, mb_r,
+		      pai->qu->flags & adns_qf_quoteok_anshost ? pdf_quoteok : 0);
+  }
 }
 
 /*
