FIFO-interoperability patches to dig and nslookup

Andris Kalnozols andris at hpl.hp.com
Sun Sep 1 02:41:05 UTC 2002


Here are the one-liners that will enable the 9.X versions of
dig and nslookup to be used in scripts in which individual
queries are submitted via a named pipe.  The single call to
fflush() is made just before another input line is read from
the batch file [dig] or stdin [nslookup].  The changes will
restore this aspect of backwards-compatibility with the 8.X
versions of these programs.  

The patches are against the 9.2.2rc1 code base.

Regards,
Andris


--- dig.c.orig	Mon Mar 11 19:55:57 2002
+++ dig.c	Sat Aug 31 14:32:40 2002
@@ -132,8 +132,8 @@
 print_usage(FILE *fp) {
 	fputs(
 "Usage:  dig [@global-server] [domain] [q-type] [q-class] {q-opt}\n"
-"        {global-d-opt} host [@local-server] {local-d-opt}\n"
-"        [ host [@local-server] {local-d-opt} [...]]\n", fp);
+"            {global-d-opt} host [@local-server] {local-d-opt}\n"
+"            [ host [@local-server] {local-d-opt} [...]]\n", fp);
 }
 
 static void
@@ -148,7 +148,7 @@
 help(void) {
 	print_usage(stdout);
 	fputs(
-"Where:  domain	  are in the Domain Name System\n"
+"Where:  domain   is in the Domain Name System\n"
 "        q-class  is one of (in,hs,ch,...) [default: in]\n"
 "        q-type   is one of (a,any,mx,ns,soa,hinfo,axfr,txt,...) [default:a]\n"
 "                 (Use ixfr=version for type ixfr)\n"
@@ -1310,9 +1310,9 @@
 }
 
 /*
- * Callback from dighost.c to allow program-specific shutdown code.  Here,
- * Here, we're possibly reading from a batch file, then shutting down for
- * real if there's nothing in the batch file to read.
+ * Callback from dighost.c to allow program-specific shutdown code.
+ * Here, we're possibly reading from a batch file, then shutting down
+ * for real if there's nothing in the batch file to read.
  */
 void
 dighost_shutdown(void) {
@@ -1327,6 +1327,7 @@
 		return;
 	}
 
+	fflush(stdout);
 	if (feof(batchfp)) {
 		batchname = NULL;
 		isc_app_shutdown();
--- nslookup.c.orig	Wed Mar 20 14:45:11 2002
+++ nslookup.c	Sat Aug 31 14:08:36 2002
@@ -701,6 +701,7 @@
 	char *ptr, *arg;
 	char *input;
 
+	fflush(stdout);
 	buf = isc_mem_allocate(mctx, COMMSIZE);
 	if (buf == NULL)
 		fatal("memory allocation failure");



More information about the bind-workers mailing list