X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/1ed63b5d0630a4b5b4a8d31174d9f3e95a970913..0f19351efd103bf3bae5d005fadab4b6843055a4:/print-ascii.c diff --git a/print-ascii.c b/print-ascii.c index 56efc84a..e5b7a582 100644 --- a/print-ascii.c +++ b/print-ascii.c @@ -43,8 +43,11 @@ #endif #include "netdissect-stdinc.h" + #include +#include "netdissect-ctype.h" + #include "netdissect.h" #include "extract.h" @@ -55,8 +58,6 @@ #define HEXDUMP_HEXSTUFF_PER_LINE \ (HEXDUMP_HEXSTUFF_PER_SHORT * HEXDUMP_SHORTS_PER_LINE) -static void hex_and_ascii_print_with_offset(netdissect_options *, const char *, const u_char *, u_int, u_int); - void ascii_print(netdissect_options *ndo, const u_char *cp, u_int length) @@ -86,7 +87,7 @@ ascii_print(netdissect_options *ndo, if (length > 1 && GET_U_1(cp) != '\n') ND_PRINT("."); } else { - if (!ND_ISGRAPH(s) && + if (!ND_ASCII_ISGRAPH(s) && (s != '\t' && s != ' ' && s != '\n')) ND_PRINT("."); else @@ -120,8 +121,8 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident, (void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff), " %02x%02x", s1, s2); hsp += HEXDUMP_HEXSTUFF_PER_SHORT; - *(asp++) = (char)(ND_ISGRAPH(s1) ? s1 : '.'); - *(asp++) = (char)(ND_ISGRAPH(s2) ? s2 : '.'); + *(asp++) = (char)(ND_ASCII_ISGRAPH(s1) ? s1 : '.'); + *(asp++) = (char)(ND_ASCII_ISGRAPH(s2) ? s2 : '.'); i++; if (i >= HEXDUMP_SHORTS_PER_LINE) { *hsp = *asp = '\0'; @@ -139,7 +140,7 @@ hex_and_ascii_print_with_offset(netdissect_options *ndo, const char *ident, (void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff), " %02x", s1); hsp += 3; - *(asp++) = (char)(ND_ISGRAPH(s1) ? s1 : '.'); + *(asp++) = (char)(ND_ASCII_ISGRAPH(s1) ? s1 : '.'); ++i; } if (i > 0) {