From 564bdb3f7488129906647c89e70f37710ea2ce33 Mon Sep 17 00:00:00 2001 From: ian Date: Sat, 16 Sep 2000 19:13:11 +0000 Subject: [PATCH] Changes as from fanf in his message of 11th May 2000. --- client/adnslogres.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/client/adnslogres.c b/client/adnslogres.c index b8e5f52..ac2aad8 100644 --- a/client/adnslogres.c +++ b/client/adnslogres.c @@ -4,12 +4,12 @@ */ /* * This file is - * Copyright (C) 1999 Tony Finch + * Copyright (C) 1999-2000 Tony Finch * Copyright (C) 1999-2000 Ian Jackson * * It is part of adns, which is * Copyright (C) 1997-2000 Ian Jackson - * Copyright (C) 1999 Tony Finch + * Copyright (C) 1999-2000 Tony Finch * * 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 @@ -48,7 +48,8 @@ static const char * const cvsid = #include "adns.h" /* maximum number of concurrent DNS queries */ -#define MAXPENDING 1000 +#define MAXPENDING 64000 +#define MAXPENDING 64000 /* maximum length of a line */ #define MAXLINE 1024 @@ -204,12 +205,13 @@ static void proclog(FILE *inf, FILE *outf, int opts) { } static void usage(void) { - fprintf(stderr, "usage: %s [-d] [-p] [logfile]\n", progname); + fprintf(stderr, "usage: %s [-d] [-p] [-c concurrency] [logfile]\n", progname); exit(1); } int main(int argc, char *argv[]) { - int c, opts; + int c, opts, maxpending; + extern char *optarg; FILE *inf; progname= strrchr(*argv, '/'); @@ -217,10 +219,18 @@ int main(int argc, char *argv[]) { progname++; else progname= *argv; - opts= 0; - while ((c= getopt(argc, argv, "dp")) != -1) + maxpending= MAXPENDING; + opts= 0; + while ((c= getopt(argc, argv, "c:dp")) != -1) switch (c) { + case 'c': + maxpending= atoi(optarg); + if (maxpending < 1 || maxpending > MAXPENDING) { + fprintf(stderr, "%s: unfeasible concurrency %d\n", progname, maxpending); + exit(1); + } + break; case 'd': opts|= OPT_DEBUG; break; @@ -245,7 +255,7 @@ int main(int argc, char *argv[]) { if (!inf) aargh("couldn't open input"); - proclog(inf, stdout, opts); + proclog(inf, stdout, maxpending, opts); if (fclose(inf)) aargh("fclose input"); -- 2.30.2