aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-08-29 22:53:41 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-08-29 22:53:41 +0200
commitecc2a2e015628d40d8ff55f4d68ad4dbcd6f854c (patch)
tree1fac979d227a72c0cca0b7dd3950d6e3ae4e4bfd /libbb
parent9f2e82ad2eef75eccafb2490dc6ff0983db92244 (diff)
downloadbusybox-ecc2a2e015628d40d8ff55f4d68ad4dbcd6f854c.tar.gz
ash: deal with some TODOs (mostly trivial)
function old new delta msg_illnum - 19 +19 evalvar 1365 1364 -1 illnum 19 - -19 subevalvar 1182 1158 -24 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/2 up/down: 19/-44) Total: -25 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/process_escape_sequence.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libbb/process_escape_sequence.c b/libbb/process_escape_sequence.c
index 6de2cacdd..11059d1a5 100644
--- a/libbb/process_escape_sequence.c
+++ b/libbb/process_escape_sequence.c
@@ -45,6 +45,9 @@ char FAST_FUNC bb_process_escape_sequence(const char **ptr)
}
#endif
+ /* bash requires leading 0 in octal escapes:
+ * \02 works, \2 does not (prints \ and 2).
+ * We treat \2 as a valid octal escape sequence. */
do {
d = (unsigned char)(*q) - '0';
#ifdef WANT_HEX_ESCAPES
@@ -80,7 +83,10 @@ char FAST_FUNC bb_process_escape_sequence(const char **ptr)
break;
}
} while (*++p);
- n = *(p + (sizeof(charmap)/2));
+ /* p points to found escape char or NUL,
+ * advance it and find what it translates to */
+ p += sizeof(charmap) / 2;
+ n = *p;
}
*ptr = q;