chiark / gitweb /
adnslogres new -C option
authorian <ian>
Sat, 16 Sep 2000 20:37:56 +0000 (20:37 +0000)
committerian <ian>
Sat, 16 Sep 2000 20:37:56 +0000 (20:37 +0000)
changelog
client/adnslogres.c

index 3ea291931f6f4df4216caacc866ac1d190c7a048..5e0ec1137b184d12064cbb9d00ec98ebbb4b1917 100644 (file)
--- a/changelog
+++ b/changelog
@@ -5,7 +5,7 @@ adns (0.10) unstable; urgency=low
   * Actually compile shared libraries by default !
 
   General Improvements:
-  * adnshost has --config option for overriding configuration.
+  * adnshost and adnslogres have options for overriding configuration.
   * 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 cb0bc278590e4894f703bc6d947f5565ada859b2..fc6b2cd7ee20b63d47fd40607f170432b7b47cf4 100644 (file)
@@ -59,6 +59,7 @@ static const char * const cvsid =
 #define OPT_POLL 2
 
 static const char *progname;
+static const char *config_text;
 
 #define guard_null(str) ((str) ? (str) : "")
 
@@ -163,8 +164,14 @@ static void proclog(FILE *inf, FILE *outf, int maxpending, int opts) {
   adns_state adns;
   adns_answer *answer;
   logline *head, *tail, *line;
+  adns_initflags initflags;
 
-  errno= adns_init(&adns, (opts & OPT_DEBUG) ? adns_if_debug : 0, 0);
+  initflags= (opts & OPT_DEBUG) ? adns_if_debug : 0;
+  if (config_text) {
+    errno= adns_init_strcfg(&adns, initflags, stderr, config_text);
+  } else {
+    errno= adns_init(&adns, initflags, 0);
+  }
   if (errno) aargh("adns_init");
   head= tail= readline(inf, adns, opts);
   len= 1; eof= 0;
@@ -203,7 +210,8 @@ static void proclog(FILE *inf, FILE *outf, int maxpending, int opts) {
 }
 
 static void usage(void) {
-  fprintf(stderr, "usage: %s [-d] [-p] [-c concurrency] [logfile]\n", progname);
+  fprintf(stderr, "usage: %s [-d] [-p] [-c concurrency] [-C config] [logfile]\n",
+         progname);
   exit(1);
 }
 
@@ -220,7 +228,7 @@ int main(int argc, char *argv[]) {
 
   maxpending= DEFMAXPENDING;
   opts= 0;
-  while ((c= getopt(argc, argv, "c:dp")) != -1)
+  while ((c= getopt(argc, argv, "c:C:dp")) != -1)
     switch (c) {
     case 'c':
       maxpending= atoi(optarg);
@@ -229,6 +237,9 @@ int main(int argc, char *argv[]) {
        exit(1);
       }
       break;
+    case 'C':
+      config_text= optarg;
+      break;
     case 'd':
       opts|= OPT_DEBUG;
       break;