X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=client%2Fadnslogres.c;fp=client%2Fadnslogres.c;h=fc6b2cd7ee20b63d47fd40607f170432b7b47cf4;hb=62fa243d1eecd59cb179f24549790b6d98c9aac1;hp=cb0bc278590e4894f703bc6d947f5565ada859b2;hpb=295cf5254de011800b43c6d39eab278a48ba917f;p=adns.git 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;