diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2004-04-01 14:28:28 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2004-04-01 14:28:28 +0000 |
commit | a16293f34e175408334275267776142408032d45 (patch) | |
tree | 9ea55d1fdc741253ff9eb3c9aa00c3984ce1aee5 | |
parent | ae589e848ef11d21ef9882e56dedf0dad7b47b8d (diff) |
Display string as hex bytes if it is longer than strlen()
-rw-r--r-- | tools/sdptool.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/sdptool.c b/tools/sdptool.c index 5340ab1b..abb8b439 100644 --- a/tools/sdptool.c +++ b/tools/sdptool.c @@ -396,8 +396,15 @@ void sdp_data_printf(sdp_data_t *sdpdata, case SDP_TEXT_STR8: case SDP_TEXT_STR16: case SDP_TEXT_STR32: - printf("%.*sText : \"%s\"\n", indent, indent_spaces, - sdpdata->val.str); + if (sdpdata->unitSize > strlen(sdpdata->val.str)) { + int i; + printf("%.*sData :", indent, indent_spaces); + for (i = 0; i < sdpdata->unitSize; i++) + printf(" %02x", (unsigned char) sdpdata->val.str[i]); + printf("\n"); + } else + printf("%.*sText : \"%s\"\n", indent, indent_spaces, + sdpdata->val.str); break; case SDP_URL_STR8: case SDP_URL_STR16: |