Bandwidth increase for dig -f

Andris Kalnozols andris at hpl.hp.com
Mon Feb 21 21:28:05 UTC 2000


I had an occasion to enhance a Perl script to follow CNAME chains and
was forced to do some programming gymnastics to compensate for a rather
small batch input buffer.  The following patch corrects this by not only
increasing the necessary buffer sizes, comments appearing in a batch file
are now echoed.  This alternative to the "%" command-line feature allows
programs that call dig to pass a lot more context-dependent data.

Andris Kalnozols
HP Laboratories


--- src/bin/dig/dig.c.orig	Thu Nov  4 21:05:14 1999
+++ src/bin/dig/dig.c	Mon Feb 21 10:31:34 2000
@@ -184,8 +184,8 @@
 
 /* Global. */
 
-#define VERSION 82
-#define VSTRING "8.2"
+#define VERSION 83
+#define VSTRING "8.3"
 
 #define PRF_DEF		0x2ff9
 #define PRF_MIN		0xA930
@@ -270,14 +270,14 @@
 	ns_type xfr = ns_t_invalid;
         int bytes_out, bytes_in;
 
-	char cmd[256];
+	char cmd[512];
 	char domain[MAXDNAME];
         char msg[120], *msgptr;
 	char **vtmp;
 	char *args[DIG_MAXARGS];
 	char **ax;
 	int once = 1, dofile = 0; /* batch -vs- interactive control */
-	char fileq[100];
+	char fileq[384];
 	int  fp;
 	int wait=0, delay;
 	int envset=0, envsave=0;
@@ -357,8 +357,10 @@
 	while ((dofile && fgets(fileq, sizeof fileq, qfp) != NULL) || 
 	       (!dofile && once--)) 
 	{
-		if (*fileq == '\n' || *fileq == '#' || *fileq==';')
-			continue;	/* ignore blank lines & comments */
+		if (*fileq == '\n' || *fileq == '#' || *fileq==';') {
+			printf("%s", fileq);	/* echo but otherwise ignore */
+			continue;		/* blank lines and comments  */
+		}
 
 /*
  * "Sticky" requests that before current parsing args



More information about the bind-workers mailing list