diff --git a/src/file.c b/src/file.c index bf9c4538c..d2a80b0df 100644 --- a/src/file.c +++ b/src/file.c @@ -179,37 +179,43 @@ do_transform_source (FileOpContext *ctx, const char *source) for (next_reg = 1, j = 0, k = 0; j < strlen (ctx->dest_mask); j++) { switch (ctx->dest_mask[j]) { case '\\': - j++; - if (!isdigit ((unsigned char) ctx->dest_mask[j])) { - /* Backslash followed by non-digit */ - switch (ctx->dest_mask[j]) { - case 'U': - case_conv |= UP_SECT; - case_conv &= ~LOW_SECT; - break; - case 'u': - case_conv |= UP_CHAR; - break; - case 'L': - case_conv |= LOW_SECT; - case_conv &= ~UP_SECT; - break; - case 'l': - case_conv |= LOW_CHAR; - break; - case 'E': - case_conv = NO_CONV; - break; - default: - /* Backslash as quote mark */ - fntarget[k++] = - convert_case (ctx->dest_mask[j], &case_conv); - } + if (is_escaped_string (&ctx->dest_mask[j])){ + fntarget[k++] = ctx->dest_mask[j++]; + fntarget[k++] = ctx->dest_mask[j]; break; } else { - /* Backslash followed by digit */ - next_reg = ctx->dest_mask[j] - '0'; - /* Fall through */ + j++; + if (!isdigit ((unsigned char) ctx->dest_mask[j])) { + /* Backslash followed by non-digit */ + switch (ctx->dest_mask[j]) { + case 'U': + case_conv |= UP_SECT; + case_conv &= ~LOW_SECT; + break; + case 'u': + case_conv |= UP_CHAR; + break; + case 'L': + case_conv |= LOW_SECT; + case_conv &= ~UP_SECT; + break; + case 'l': + case_conv |= LOW_CHAR; + break; + case 'E': + case_conv = NO_CONV; + break; + default: + /* Backslash as quote mark */ + fntarget[k++] = + convert_case (ctx->dest_mask[j], &case_conv); + } + break; + } else { + /* Backslash followed by digit */ + next_reg = ctx->dest_mask[j] - '0'; + /* Fall through */ + } } case '*': @@ -1875,12 +1881,6 @@ panel_operate (void *source_panel, FileOperation operation, dest = temp2; temp = NULL; - temp2 = source_with_path; - source_with_path = unescape_string(source_with_path); - mhl_mem_free(temp2); - temp2 = dest; - dest = unescape_string(dest); - mhl_mem_free(temp2); switch (operation) { case OP_COPY: /* diff --git a/src/util.c b/src/util.c index edc759a2e..c5612cf5b 100644 --- a/src/util.c +++ b/src/util.c @@ -1526,4 +1526,3 @@ Q_ (const char *s) sep = strchr(result, '|'); return (sep != NULL) ? sep + 1 : result; } - diff --git a/src/util.h b/src/util.h index 9c69e997c..706a8920f 100644 --- a/src/util.h +++ b/src/util.h @@ -14,8 +14,10 @@ extern char *str_unconst (const char *); extern const char *cstrcasestr (const char *haystack, const char *needle); extern const char *cstrstr (const char *haystack, const char *needle); -char *unescape_string ( const char * in ); -char *escape_string ( const char * in ); +char *unescape_string ( const char * ); +char *escape_string ( const char * ); +int is_escaped_string ( const char * ); + void str_replace(char *s, char from, char to); int is_printable (int c); void msglen (const char *text, /*@out@*/ int *lines, /*@out@*/ int *columns);