Attached patch fixes this problem. If query type is specified from command 
line, don't attempt default lookups.

It also fixes one more problem which annoyed me - info about server was 
printed three times if nameserver is specified from command line.


-- 
Hasso Tepper
--- bind9-9.3.1-orig/bin/dig/host.c	2004-09-06 04:33:05.000000000 +0300
+++ bind9-9.3.1/bin/dig/host.c	2005-09-26 16:58:25.000000000 +0300
@@ -56,6 +56,7 @@ extern isc_task_t *global_task;
 extern int fatalexit;
 
 static isc_boolean_t short_form = ISC_TRUE, listed_server = ISC_FALSE;
+static isc_boolean_t listed_server_printed = ISC_FALSE;
 static isc_boolean_t default_lookups = ISC_TRUE;
 static int seen_error = -1;
 static isc_boolean_t list_addresses = ISC_TRUE;
@@ -382,7 +383,7 @@ printmessage(dig_query_t *query, dns_mes
 	 */
 	force_error = (seen_error == 1) ? 1 : 0;
 	seen_error = 1;
-	if (listed_server) {
+	if (listed_server && !listed_server_printed) {
 		char sockstr[ISC_SOCKADDR_FORMATSIZE];
 
 		printf("Using domain server:\n");
@@ -391,6 +392,7 @@ printmessage(dig_query_t *query, dns_mes
 				    sizeof(sockstr));
 		printf("Address: %s\n", sockstr);
 		printf("Aliases: \n\n");
+		listed_server_printed = ISC_TRUE;
 	}
 
 	if (msg->rcode != 0) {
@@ -604,6 +606,7 @@ parse_args(isc_boolean_t is_batchfile, i
 			} else
 				list_type = rdtype;
 			list_addresses = ISC_FALSE;
+			default_lookups = ISC_FALSE;
 			break;
 		case 'c':
 			tr.base = isc_commandline_argument;

Reply via email to