I was looking at some SIP traffic (urgh) with tcpdump -A | less and
wondered why ^K and ^L were considered printable characters.  Let's
tighten this a bit.  Equivalent to what tcpdump.org has.

OK?

Index: tcpdump.c
===================================================================
RCS file: /cvs/src/usr.sbin/tcpdump/tcpdump.c,v
retrieving revision 1.70
diff -u -p -r1.70 tcpdump.c
--- tcpdump.c   18 Apr 2015 18:28:38 -0000      1.70
+++ tcpdump.c   11 Jul 2015 20:35:11 -0000
@@ -603,8 +603,10 @@ default_print_ascii(const u_char *cp, un
        printf("\n");
        for (i = 0; i < length; i++) {
                c = cp[i];
-               c = isprint(c) || isspace(c) ? c : '.';
-               putchar(c);
+               if (isprint(c) || c == '\t' || c == '\n' || c == '\r')
+                       putchar(c);
+               else
+                       putchar('.');
        }
 }
 
-- 
Christian "naddy" Weisgerber                          [email protected]

Reply via email to