diff --git a/libr/core/cconfig.c b/libr/core/cconfig.c index 62bae9a3ec..41f6b7f7b0 100644 --- a/libr/core/cconfig.c +++ b/libr/core/cconfig.c @@ -2830,7 +2830,7 @@ R_API int r_core_config_init(RCore *core) { SETOPTIONS (n, "asciiesc", "asciidot", NULL); /* str */ - SETCB ("str.escbslash", "false", &cb_str_escbslash, "Escape the backslash (iz and Cs-based output only)"); + SETCB ("str.escbslash", "false", &cb_str_escbslash, "Escape the backslash"); /* search */ SETCB ("search.contiguous", "true", &cb_contiguous, "Accept contiguous/adjacent search hits"); diff --git a/libr/core/disasm.c b/libr/core/disasm.c index 1842020d3e..08a89234b0 100644 --- a/libr/core/disasm.c +++ b/libr/core/disasm.c @@ -3094,26 +3094,27 @@ static char *ds_esc_str(RDisasmState *ds, const char *str, int len, const char * int str_len; char *escstr = NULL; const char *prefix = ""; + bool esc_bslash = ds->core->print->esc_bslash; switch (ds->strenc) { case R_STRING_ENC_LATIN1: - escstr = r_str_escape_latin1 (str, ds->show_asciidot, true); + escstr = r_str_escape_latin1 (str, ds->show_asciidot, esc_bslash); break; case R_STRING_ENC_UTF8: - escstr = r_str_escape_utf8 (str, ds->show_asciidot, true); + escstr = r_str_escape_utf8 (str, ds->show_asciidot, esc_bslash); break; case R_STRING_ENC_UTF16LE: - escstr = r_str_escape_utf16le (str, len, ds->show_asciidot); + escstr = r_str_escape_utf16le (str, len, ds->show_asciidot, esc_bslash); prefix = "u"; break; case R_STRING_ENC_UTF32LE: - escstr = r_str_escape_utf32le (str, len, ds->show_asciidot); + escstr = r_str_escape_utf32le (str, len, ds->show_asciidot, esc_bslash); prefix = "U"; break; default: str_len = strlen (str); if ((str_len == 1 && len > 3 && str[2] && !str[3]) || (str_len == 3 && len > 5 && !memcmp (str, "\xff\xfe", 2) && str[4] && !str[5])) { - escstr = r_str_escape_utf16le (str, len, ds->show_asciidot); + escstr = r_str_escape_utf16le (str, len, ds->show_asciidot, esc_bslash); prefix = "u"; } else if (str_len == 1 && len > 7 && !str[2] && !str[3] && str[4] && !str[5]) { RStrEnc enc = R_STRING_ENC_UTF32LE; @@ -3130,10 +3131,10 @@ static char *ds_esc_str(RDisasmState *ds, const char *str, int len, const char * } } if (enc == R_STRING_ENC_UTF32LE) { - escstr = r_str_escape_utf32le (str, len, ds->show_asciidot); + escstr = r_str_escape_utf32le (str, len, ds->show_asciidot, esc_bslash); prefix = "U"; } else { - escstr = r_str_escape_latin1 (str, ds->show_asciidot, true); + escstr = r_str_escape_latin1 (str, ds->show_asciidot, esc_bslash); } } else { RStrEnc enc = R_STRING_ENC_LATIN1; @@ -3145,8 +3146,8 @@ static char *ds_esc_str(RDisasmState *ds, const char *str, int len, const char * } } escstr = (enc == R_STRING_ENC_UTF8 ? - r_str_escape_utf8 (str, ds->show_asciidot, true) : - r_str_escape_latin1 (str, ds->show_asciidot, true)); + r_str_escape_utf8 (str, ds->show_asciidot, esc_bslash) : + r_str_escape_latin1 (str, ds->show_asciidot, esc_bslash)); } } if (prefix_out) { diff --git a/libr/include/r_util/r_str.h b/libr/include/r_util/r_str.h index bb0f8d859b..b9fb95e8b5 100644 --- a/libr/include/r_util/r_str.h +++ b/libr/include/r_util/r_str.h @@ -126,8 +126,8 @@ R_API char *r_str_escape(const char *buf); R_API char *r_str_escape_dot(const char *buf); R_API char *r_str_escape_latin1(const char *buf, bool show_asciidot, bool esc_bslash); R_API char *r_str_escape_utf8(const char *buf, bool show_asciidot, bool esc_bslash); -R_API char *r_str_escape_utf16le(const char *buf, int buf_size, bool show_asciidot); -R_API char *r_str_escape_utf32le(const char *buf, int buf_size, bool show_asciidot); +R_API char *r_str_escape_utf16le(const char *buf, int buf_size, bool show_asciidot, bool esc_bslash); +R_API char *r_str_escape_utf32le(const char *buf, int buf_size, bool show_asciidot, bool esc_bslash); R_API void r_str_uri_decode(char *buf); R_API char *r_str_uri_encode(const char *buf); R_API char *r_str_utf16_decode(const ut8 *s, int len); diff --git a/libr/util/str.c b/libr/util/str.c index 900f3136d9..beb40f16dd 100644 --- a/libr/util/str.c +++ b/libr/util/str.c @@ -1294,12 +1294,12 @@ R_API char *r_str_escape_utf8(const char *buf, bool show_asciidot, bool esc_bsla return r_str_escape_utf (buf, -1, R_STRING_ENC_UTF8, show_asciidot, esc_bslash); } -R_API char *r_str_escape_utf16le(const char *buf, int buf_size, bool show_asciidot) { - return r_str_escape_utf (buf, buf_size, R_STRING_ENC_UTF16LE, show_asciidot, true); +R_API char *r_str_escape_utf16le(const char *buf, int buf_size, bool show_asciidot, bool esc_bslash) { + return r_str_escape_utf (buf, buf_size, R_STRING_ENC_UTF16LE, show_asciidot, esc_bslash); } -R_API char *r_str_escape_utf32le(const char *buf, int buf_size, bool show_asciidot) { - return r_str_escape_utf (buf, buf_size, R_STRING_ENC_UTF32LE, show_asciidot, true); +R_API char *r_str_escape_utf32le(const char *buf, int buf_size, bool show_asciidot, bool esc_bslash) { + return r_str_escape_utf (buf, buf_size, R_STRING_ENC_UTF32LE, show_asciidot, esc_bslash); } /* ansi helpers */