aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sh/strtrans.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>2005-12-07 14:08:12 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:57 +0000
commit95732b497d12c98613bb3c5db16b61f377501a59 (patch)
tree5e1cdf79eb0407e09dca4c0ec29e11442c7d1d15 /lib/sh/strtrans.c
parenteb87367179effbe5f430236db8259006d71438b7 (diff)
downloadandroid_external_bash-95732b497d12c98613bb3c5db16b61f377501a59.tar.gz
android_external_bash-95732b497d12c98613bb3c5db16b61f377501a59.tar.bz2
android_external_bash-95732b497d12c98613bb3c5db16b61f377501a59.zip
Imported from ../bash-3.1.tar.gz.
Diffstat (limited to 'lib/sh/strtrans.c')
-rw-r--r--lib/sh/strtrans.c8
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;