diff options
author | Evan Huus <eapache@gmail.com> | 2013-10-12 12:38:56 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-10-12 12:38:56 +0000 |
commit | fa1027a0048c1de11cb01dfdded3a88595a4a8c9 (patch) | |
tree | a2aa62eea1a16934e047fab80ae0f58f19ec4b04 /epan/strutil.h | |
parent | 522f74e9aa0059e9f2ec681117640d829e11e1c8 (diff) | |
download | wireshark-fa1027a0048c1de11cb01dfdded3a88595a4a8c9.tar.gz wireshark-fa1027a0048c1de11cb01dfdded3a88595a4a8c9.tar.bz2 wireshark-fa1027a0048c1de11cb01dfdded3a88595a4a8c9.zip |
From RobiOneKenobi via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9229
Add a new strutil function format_text_chr that replaces unprintable characters
with a single passed-in char (eg a '.' or a '-') instead of a C-style escape.
This is useful for displaying binary data that frequently but not always
contains text; otherwise the number of C escape codes makes it unreadable.
svn path=/trunk/; revision=52563
Diffstat (limited to 'epan/strutil.h')
-rw-r--r-- | epan/strutil.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/epan/strutil.h b/epan/strutil.h index 255993da65..7eacb67fe8 100644 --- a/epan/strutil.h +++ b/epan/strutil.h @@ -86,6 +86,22 @@ gchar* format_text(const guchar *line, size_t len); WS_DLL_PUBLIC gchar* format_text_wsp(const guchar *line, size_t len); +/* + * Given a string, generate a string from it that shows non-printable + * characters as the chr parameter passed, except a whitespace character + * (space, tab, carriage return, new line, vertical tab, or formfeed) + * which will be replaced by a space, and return a pointer to it. + * + * @param line A pointer to the input string + * @param len The length of the input string + * @param chr The character to use to replace non-printable characters + * @return A pointer to the formatted string + * + */ +WS_DLL_PUBLIC +gchar* format_text_chr(const guchar *string, const size_t len, const guchar chr); + + /** Turn an array of bytes into a string showing the bytes in hex. * * @param bd A pointer to the byte array |