From ecc2a2e015628d40d8ff55f4d68ad4dbcd6f854c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 29 Aug 2009 22:53:41 +0200 Subject: 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 --- libbb/process_escape_sequence.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libbb') 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; -- cgit v1.2.3