Merge remote-tracking branch 'goog/tcpdump'

* goog/tcpdump: (3066 commits)
  Remove old version. Getting ready for new tcpdump 4.5
  Support -Q for setting the capture direction.
  Clean up the TLV processing loop.
  With -A and -AA, don't send CRs to the standard output.
  Use the new libpcap <pcap/nflog.h> for NFLOG definitions and declarations.
  Do our own isascii(), isprint(), isgraph(), and toascii().
  Fix a compiler warning.
  Don't use the __attribute__((packed)) on most platforms.
  The interval in an AODV HELLO extension is not aligned on a 4-byte boundary.
  As with memcpy, so with memcmp.
  More UNALIGNED_MEM{CPY,CMP} on IP addresses.
  Another case where UNALIGNED_MEMCPY() is probably necessary.
  No need for casting back and forth.
  Only do the unaligned_mem{cpy,cmp} hack if necessary.
  No need to declare unaligned_mem{cpy,cmp} in netdissect.h *and* interface.h.
  More possibly-unaligned memcpy()s and assignments - use unaligned_memcpy().
  Check for compiling for IPv6; don't check whether we can create an IPv6 socket.
  Use unaligned_memcmp() to compare with IPv{4,6} addresses in a packet.
  Use EXTRACT_nBITS even when just testing against zero.
  Fix some more unaligned accesses.
  ...

Change-Id: I9e98707d30c989b9e32dcd5af798bd0746ab4434
diff --git a/print-ascii.c b/print-ascii.c
index cd48edd..f09aa98 100644
--- a/print-ascii.c
+++ b/print-ascii.c
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-     "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.16.2.1 2005/07/06 20:54:49 guy Exp $";
+     "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.17 2005-07-06 20:53:32 guy Exp $";
 #endif
 #include <tcpdump-stdinc.h>
 #include <stdio.h>
@@ -65,11 +65,25 @@
 	while (length > 0) {
 		s = *cp++;
 		length--;
-		if (!isgraph(s) &&
-		    (s != '\t' && s != ' ' && s != '\n' && s != '\r'))
-			putchar('.');
-		else
-			putchar(s);
+		if (s == '\r') {
+			/*
+			 * Don't print CRs at the end of the line; they
+			 * don't belong at the ends of lines on UN*X,
+			 * and the standard I/O library will give us one
+			 * on Windows so we don't need to print one
+			 * ourselves.
+			 *
+			 * In the middle of a line, just print a '.'.
+			 */
+			if (length > 1 && *cp != '\n')
+				putchar('.');
+		} else {
+			if (!ND_ISGRAPH(s) &&
+			    (s != '\t' && s != ' ' && s != '\n'))
+				putchar('.');
+			else
+				putchar(s);
+		}
 	}
 }
 
@@ -92,8 +106,8 @@
 		(void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
 		    " %02x%02x", s1, s2);
 		hsp += HEXDUMP_HEXSTUFF_PER_SHORT;
-		*(asp++) = (isgraph(s1) ? s1 : '.');
-		*(asp++) = (isgraph(s2) ? s2 : '.');
+		*(asp++) = (ND_ISGRAPH(s1) ? s1 : '.');
+		*(asp++) = (ND_ISGRAPH(s2) ? s2 : '.');
 		i++;
 		if (i >= HEXDUMP_SHORTS_PER_LINE) {
 			*hsp = *asp = '\0';
@@ -109,7 +123,7 @@
 		(void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
 		    " %02x", s1);
 		hsp += 3;
-		*(asp++) = (isgraph(s1) ? s1 : '.');
+		*(asp++) = (ND_ISGRAPH(s1) ? s1 : '.');
 		++i;
 	}
 	if (i > 0) {