From 62fa243d1eecd59cb179f24549790b6d98c9aac1 Mon Sep 17 00:00:00 2001 From: ian Date: Sat, 16 Sep 2000 20:37:56 +0000 Subject: [PATCH] adnslogres new -C option --- changelog | 2 +- client/adnslogres.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/changelog b/changelog index 3ea2919..5e0ec11 100644 --- 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. diff --git a/client/adnslogres.c b/client/adnslogres.c index cb0bc27..fc6b2cd 100644 --- a/client/adnslogres.c +++ b/client/adnslogres.c @@ -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; -- 2.30.2