***************
*** 1098,1122 ****
  		break;
  	    }
! 
  	    numAnswers++;
  	    cp = answer + HFIXEDSZ;
! 	    if (ntohs(((HEADER *)answer)->qdcount) > 0)
! 		cp += dn_skipname((u_char *)cp,
! 		    (u_char *)answer + len) + QFIXEDSZ;
! 	    nmp = cp;
! 	    cp += dn_skipname((u_char *)cp, (u_char *)answer + len);
! 	    if ((_getshort((u_char*)cp) == T_SOA)) {
! 		(void) dn_expand(answer, answer + len, nmp,
! 				 dname[soacnt], sizeof dname[0]);
! 	        if (soacnt) {
! 		    if (strcmp(dname[0], dname[1]) == 0)
! 			break;
! 		} else
! 		    soacnt++;
  	    }
  	}
  
! 	fprintf(stdout, ";; Received %d record%s.\n",
! 		numAnswers, (numAnswers != 1) ? "s" : "");
  
  	(void) close(sockFD);
--- 1100,1141 ----
  		break;
  	    }
! 	    numRecords += htons(((HEADER *)answer)->ancount);
  	    numAnswers++;
+ 
+ 	    /* Header. */
  	    cp = answer + HFIXEDSZ;
! 	    /* Question. */
! 	    for (count = ntohs(((HEADER *)answer)->qdcount);	
! 		 count > 0;
! 		 count--)
! 		cp += dn_skipname(cp, answer + len) + QFIXEDSZ;
! 	    /* Answer. */
! 	    for (count = ntohs(((HEADER *)answer)->ancount);
! 		 count > 0;
! 		 count--) {
! 		n = dn_expand(answer, answer + len, cp,
! 			      dname[soacnt], sizeof dname[0]);
! 		if (n < 0) {
! 		    error = ERR_PRINTING;
! 		    done++;
! 		    break;
! 		}
! 		cp += n;
! 		GETSHORT(type, cp);
! 		GETSHORT(class, cp);
! 		cp += INT32SZ;	/* ttl */
! 		GETSHORT(rlen, cp);
! 		cp += rlen;
! 		if (type == T_SOA && soacnt++ &&
! 		    !strcasecmp(dname[0], dname[1])) {
! 		    done++;
! 		    break;
! 		}
  	    }
  	}
  
! 	printf(";; Received %d answer%s (%d record%s).\n",
! 	       numAnswers, (numAnswers != 1) ? "s" : "",
! 	       numRecords, (numRecords != 1) ? "s" : "");
  
  	(void) close(sockFD);
***************
*** 1173,1185 ****
      if (ntohs(headerPtr->ancount) == 0) {
  	return(NO_INFO);
!     } else {
! 	if (ntohs(headerPtr->qdcount) > 0) {
! 	    nameLen = dn_skipname(cp, eom);
! 	    if (nameLen < 0)
! 		return (ERROR);
! 	    cp += nameLen + QFIXEDSZ;
! 	}
! 	cp = (u_char*) p_rr(cp, msg, stdout);
      }
      return(SUCCESS);
  }
--- 1192,1208 ----
      if (ntohs(headerPtr->ancount) == 0) {
  	return(NO_INFO);
!     }
!     for (n = ntohs(headerPtr->qdcount); n > 0; n--) {
! 	nameLen = dn_skipname(cp, eom);
! 	if (nameLen < 0)
! 	    return (ERROR);
! 	cp += nameLen + QFIXEDSZ;
      }
+ #ifdef PROTOCOLDEBUG
+     printf(";;; (message of %d octets has %d answers)\n",
+ 	   eom - msg, ntohs(headerPtr->ancount));
+ #endif
+     for (n = ntohs(headerPtr->ancount); n > 0; n--)
+ 	cp = (u_char*) p_rr(cp, msg, stdout);
      return(SUCCESS);
  }
