diff options
Diffstat (limited to 'lib/sh/strtrans.c')
-rw-r--r-- | lib/sh/strtrans.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/sh/strtrans.c b/lib/sh/strtrans.c index e264e3d..acf9d69 100644 --- a/lib/sh/strtrans.c +++ b/lib/sh/strtrans.c @@ -44,7 +44,8 @@ that we're translating a string for `echo -e', and therefore should not treat a single quote as a character that may be escaped with a backslash. If (FLAGS&2) is non-zero, we're expanding for the parser and want to - quote CTLESC and CTLNUL with CTLESC */ + quote CTLESC and CTLNUL with CTLESC. If (flags&4) is non-zero, we want + to remove the backslash before any unrecognized escape sequence. */ char * ansicstr (string, len, flags, sawc, rlen) char *string; @@ -141,7 +142,10 @@ ansicstr (string, len, flags, sawc, rlen) break; } /*FALLTHROUGH*/ - default: *r++ = '\\'; break; + default: + if ((flags & 4) == 0) + *r++ = '\\'; + break; } if ((flags & 2) && (c == CTLESC || c == CTLNUL)) *r++ = CTLESC; |