diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-02-02 15:17:06 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-02-02 15:17:06 -0800 |
commit | 3454732513abdbd1490c6107a94c6474f71a74d2 (patch) | |
tree | bf0126f8412e8bb2144268691c4c6adc2342559f /print-ascii.c | |
parent | 89e2444c8b41776ad96c7a4c90a7bc030165c259 (diff) | |
download | tcpdump-3454732513abdbd1490c6107a94c6474f71a74d2.tar.gz |
Do our own isascii(), isprint(), isgraph(), and toascii().
We do *not* want the behavior of isprint() and isgraph() to be
locale-dependent - we want both of them to return "true" only for ASCII
characters.
We have to do our own isascii() and toascii() on non-UN*X systems
anyway, so let's just do all of them ourselves.
Diffstat (limited to 'print-ascii.c')
-rw-r--r-- | print-ascii.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/print-ascii.c b/print-ascii.c index 9315edd2..3ff8887b 100644 --- a/print-ascii.c +++ b/print-ascii.c @@ -62,7 +62,7 @@ ascii_print(register const u_char *cp, register u_int length) while (length > 0) { s = *cp++; length--; - if (!isgraph(s) && + if (!ND_ISGRAPH(s) && (s != '\t' && s != ' ' && s != '\n' && s != '\r')) putchar('.'); else @@ -89,8 +89,8 @@ hex_and_ascii_print_with_offset(register const char *ident, (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'; @@ -106,7 +106,7 @@ hex_and_ascii_print_with_offset(register const char *ident, (void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff), " %02x", s1); hsp += 3; - *(asp++) = (isgraph(s1) ? s1 : '.'); + *(asp++) = (ND_ISGRAPH(s1) ? s1 : '.'); ++i; } if (i > 0) { |