chiark / gitweb /
+ * Fix adnsresfilter usage message to include correct default timeout.
authorian <ian>
Sat, 16 Sep 2000 20:49:38 +0000 (20:49 +0000)
committerian <ian>
Sat, 16 Sep 2000 20:49:38 +0000 (20:49 +0000)
@@ -3,9 +3,11 @@
   Bugfixes:
   * Fix incorrect `compressed datagram contains loop' error.
   * Actually compile shared libraries by default !
+  * Fix adnsresfilter usage message to include correct default timeout.

   General Improvements:
-  * adnshost and adnslogres have options for overriding configuration.
+  * adnshost, adnslogres, adnsresfilter have options for config override.
+  * adnsresfilter has --debug option.
   * Improvements to adnslogres (incl. new -c option) from Tony Finch.
   * Regression tests now include `adnshost' invocations.
   * Test cancellation both before and after query completion.

changelog
client/adnsresfilter.c

index 5e0ec1137b184d12064cbb9d00ec98ebbb4b1917..342cdc19047ce6947a6b517d60a31da2734248ba 100644 (file)
--- a/changelog
+++ b/changelog
@@ -3,9 +3,11 @@ adns (0.10) unstable; urgency=low
   Bugfixes:
   * Fix incorrect `compressed datagram contains loop' error.
   * Actually compile shared libraries by default !
   Bugfixes:
   * Fix incorrect `compressed datagram contains loop' error.
   * Actually compile shared libraries by default !
+  * Fix adnsresfilter usage message to include correct default timeout.
 
   General Improvements:
 
   General Improvements:
-  * adnshost and adnslogres have options for overriding configuration.
+  * adnshost, adnslogres, adnsresfilter have options for config override. 
+  * adnsresfilter has --debug option.
   * Improvements to adnslogres (incl. new -c option) from Tony Finch.
   * Regression tests now include `adnshost' invocations.
   * Test cancellation both before and after query completion.
   * Improvements to adnslogres (incl. new -c option) from Tony Finch.
   * Regression tests now include `adnshost' invocations.
   * Test cancellation both before and after query completion.
index bba1b1c65c6e1680985d4bcc193f0b47f5706896..02d0f4c2e4a35d0062dec2e6ae7c45c15caba017 100644 (file)
 #include "dlist.h"
 #include "tvarith.h"
 
 #include "dlist.h"
 #include "tvarith.h"
 
+#ifdef ADNS_REGRESS_TEST
+# include "hredirect.h"
+#endif
+
 struct outqueuenode {
   struct outqueuenode *next, *back;
   void *buffer;
 struct outqueuenode {
   struct outqueuenode *next, *back;
   void *buffer;
@@ -54,6 +58,8 @@ struct outqueuenode {
 static int bracket, forever, address;
 static unsigned long timeout= 1000;
 static adns_rrtype rrt= adns_r_ptr;
 static int bracket, forever, address;
 static unsigned long timeout= 1000;
 static adns_rrtype rrt= adns_r_ptr;
+static adns_initflags initflags= 0;
+static const char *config_text;
 
 static int outblocked, inputeof;
 static struct { struct outqueuenode *head, *tail; } outqueue;
 
 static int outblocked, inputeof;
 static struct { struct outqueuenode *head, *tail; } outqueue;
@@ -116,8 +122,10 @@ static void usage(void) {
             "         -b|--brackets    (require [...] around IP addresses)\n"
             "         -a|--address     (always include [address] in output)\n"
             "         -u|--unchecked   (do not forward map for checking)\n"
             "         -b|--brackets    (require [...] around IP addresses)\n"
             "         -a|--address     (always include [address] in output)\n"
             "         -u|--unchecked   (do not forward map for checking)\n"
+            "         --config <text>  (use this instead of resolv.conf)\n"
+            "         --debug          (turn on adns resolver debugging)\n"
             "Timeout is the maximum amount to delay any particular bit of output for.\n"
             "Timeout is the maximum amount to delay any particular bit of output for.\n"
-            "Lookups will go on in the background.  Default timeout = 100 (ms).\n")
+            "Lookups will go on in the background.  Default timeout = 1000 (ms).\n")
       == EOF) outputerr();
 }
 
       == EOF) outputerr();
 }
 
@@ -147,48 +155,53 @@ static void parseargs(const char *const *argv) {
   while ((arg= *++argv)) {
     if (arg[0] != '-') usageerr("no non-option arguments are allowed");
     if (arg[1] == '-') {
   while ((arg= *++argv)) {
     if (arg[0] != '-') usageerr("no non-option arguments are allowed");
     if (arg[1] == '-') {
-      if (!strcmp(arg,"--brackets")) {
-       bracket= 1;
-      } else if (!strcmp(arg,"--unchecked")) {
-       rrt= adns_r_ptr_raw;
+      if (!strcmp(arg,"--timeout")) {
+       if (!(arg= *++argv)) usageerr("--timeout needs a value");
+       settimeout(arg);
+       forever= 0;
       } else if (!strcmp(arg,"--wait")) {
        forever= 1;
       } else if (!strcmp(arg,"--wait")) {
        forever= 1;
+      } else if (!strcmp(arg,"--brackets")) {
+       bracket= 1;
       } else if (!strcmp(arg,"--address")) {
        address= 1;
       } else if (!strcmp(arg,"--address")) {
        address= 1;
+      } else if (!strcmp(arg,"--unchecked")) {
+       rrt= adns_r_ptr_raw;
+      } else if (!strcmp(arg,"--config")) {
+       if (!(arg= *++argv)) usageerr("--config needs a value");
+       config_text= arg;
+      } else if (!strcmp(arg,"--debug")) {
+       initflags |= adns_if_debug;
       } else if (!strcmp(arg,"--help")) {
        usage(); quit(0);
       } else if (!strcmp(arg,"--help")) {
        usage(); quit(0);
-      } else if (!strcmp(arg,"--timeout")) {
-       if (!(arg= *++argv)) usageerr("--timeout needs a value");
-       settimeout(arg);
-       forever= 0;
       } else {
        usageerr("unknown long option");
       }
     } else {
       while ((c= *++arg)) {
        switch (c) {
       } else {
        usageerr("unknown long option");
       }
     } else {
       while ((c= *++arg)) {
        switch (c) {
-       case 'b':
-         bracket= 1;
-         break;
-       case 'u':
-         rrt= adns_r_ptr_raw;
+       case 't':
+         if (*++arg) settimeout(arg);
+         else if ((arg= *++argv)) settimeout(arg);
+         else usageerr("-t needs a value");
+         forever= 0;
+         arg= "\0";
          break;
        case 'w':
          forever= 1;
          break;
          break;
        case 'w':
          forever= 1;
          break;
+       case 'b':
+         bracket= 1;
+         break;
        case 'a':
          address= 1;
          break;
        case 'a':
          address= 1;
          break;
+       case 'u':
+         rrt= adns_r_ptr_raw;
+         break;
        case 'h':
          usage();
          quit(0);
        case 'h':
          usage();
          quit(0);
-       case 't':
-         if (*++arg) settimeout(arg);
-         else if ((arg= *++argv)) settimeout(arg);
-         else usageerr("-t needs a value");
-         forever= 0;
-         arg= "\0";
-         break;
        default:
          usageerr("unknown short option");
        }
        default:
          usageerr("unknown short option");
        }
@@ -380,7 +393,12 @@ static void startup(void) {
   if (nonblock(1,1)) sysfail("set stdout to nonblocking mode");
   memset(&sa,0,sizeof(sa));
   sa.sin_family= AF_INET;
   if (nonblock(1,1)) sysfail("set stdout to nonblocking mode");
   memset(&sa,0,sizeof(sa));
   sa.sin_family= AF_INET;
-  r= adns_init(&ads,0,0);  if (r) adnsfail("init",r);
+  if (config_text) {
+    r= adns_init_strcfg(&ads,initflags,stderr,config_text);
+  } else {
+    r= adns_init(&ads,initflags,0);
+  }
+  if (r) adnsfail("init",r);
   cbyte= -1;
   inbyte= -1;
   inbuf= 0;
   cbyte= -1;
   inbyte= -1;
   inbuf= 0;