summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools_str.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/h5tools_str.c')
-rw-r--r--tools/lib/h5tools_str.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 9faba55..9214b89 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -475,33 +475,50 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch)
} else {
switch (ch) {
case '"':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\"");
+ else
h5tools_str_append(str, "\\\"");
break;
case '\\':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\\");
+ else
h5tools_str_append(str, "\\\\");
break;
case '\b':
+ if (!info->do_escape)
+ h5tools_str_append(str, "\b");
+ else
h5tools_str_append(str, "\\b");
break;
case '\f':
- h5tools_str_append(str, "\\f");
+ if (!info->do_escape)
+ h5tools_str_append(str, "\f");
+ else
+ h5tools_str_append(str, "\\f");
break;
case '\n':
- if (info->do_lf) {
- h5tools_str_append(str, "\n");
- h5tools_str_append(str, " ");
- }
- else
- h5tools_str_append(str, "\\n");
+ if (!info->do_escape) {
+ h5tools_str_append(str, "\n");
+ h5tools_str_append(str, " ");
+ }
+ else
+ h5tools_str_append(str, "\\n");
break;
case '\r':
+ if (!info->do_escape) {
+ h5tools_str_append(str, "\r");
+ h5tools_str_append(str, " ");
+ }
+ else
h5tools_str_append(str, "\\r");
break;
case '\t':
- if (info->do_lf)
- h5tools_str_append(str, "\t");
- else
- h5tools_str_append(str, "\\t");
+ if (!info->do_escape)
+ h5tools_str_append(str, "\t");
+ else
+ h5tools_str_append(str, "\\t");
break;
default:
if (isprint(ch))
@@ -514,6 +531,7 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch)
}
}
+
/*-------------------------------------------------------------------------
* Function: h5tools_str_sprint
*