psx escapes newlines (#10089)

This commit is contained in:
Khairul Azhar Kasmiran 2018-05-15 19:33:20 +08:00 committed by GitHub
parent a5477b2de0
commit bae0f69aab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -4540,7 +4540,7 @@ static int cmd_print(void *data, const char *input) {
break;
case 'x': // "psx"
if (l > 0) {
r_print_string (core->print, core->offset, block, len, 0);
r_print_string (core->print, core->offset, block, len, R_PRINT_STRING_ESC_NL);
}
break;
case 'b': // "psb"

View File

@ -158,6 +158,7 @@ R_API void r_print_offset_sg(RPrint *p, ut64 off, int invert, int offseg, int se
#define R_PRINT_STRING_URLENCODE 4
#define R_PRINT_STRING_WRAP 8
#define R_PRINT_STRING_WIDE32 16
#define R_PRINT_STRING_ESC_NL 32
R_API int r_print_string(RPrint *p, ut64 seek, const ut8 *str, int len, int options);
R_API int r_print_date_dos(RPrint *p, const ut8 *buf, int len);
R_API int r_print_date_hfs(RPrint *p, const ut8 *buf, int len);

View File

@ -571,6 +571,7 @@ R_API int r_print_string(RPrint *p, ut64 seek, const ut8 *buf, int len, int opti
bool zeroend = (options & R_PRINT_STRING_ZEROEND);
bool wrap = (options & R_PRINT_STRING_WRAP);
bool urlencode = (options & R_PRINT_STRING_URLENCODE);
bool esc_nl = (options & R_PRINT_STRING_ESC_NL);
p->interrupt = 0;
int col = 0;
i = 0;
@ -600,7 +601,7 @@ R_API int r_print_string(RPrint *p, ut64 seek, const ut8 *buf, int len, int opti
// TODO: some ascii can be bypassed here
p->cb_printf ("%%%02x", b);
} else {
if (b == '\n' || IS_PRINTABLE (b)) {
if ((b == '\n' && !esc_nl) || IS_PRINTABLE (b)) {
p->cb_printf ("%c", b);
} else {
p->cb_printf ("\\x%02x", b);