aboutsummaryrefslogtreecommitdiff
path: root/shell/hush.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-08-12 19:47:44 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-08-12 19:47:44 +0200
commitcbfe6ad4c6c6a218a3dd89623911183aca91b061 (patch)
tree10e0cbe1c2c7b87e828784c64628a84e2cfa795a /shell/hush.c
parent19679784c03089c585c609335389f034172a11ff (diff)
downloadbusybox-w32-cbfe6ad4c6c6a218a3dd89623911183aca91b061.tar.gz
busybox-w32-cbfe6ad4c6c6a218a3dd89623911183aca91b061.tar.bz2
busybox-w32-cbfe6ad4c6c6a218a3dd89623911183aca91b061.zip
hush: fix \<newline> handling on NOMMU
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush.c')
-rw-r--r--shell/hush.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c
index f49630a75..08e7f5052 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -6038,6 +6038,8 @@ static struct pipe *parse_stream(char **pstring,
6038 dest.o_assignment = NOT_ASSIGNMENT; 6038 dest.o_assignment = NOT_ASSIGNMENT;
6039 } 6039 }
6040 6040
6041 /* Note: nommu_addchr(&ctx.as_string, ch) is already done */
6042
6041 switch (ch) { 6043 switch (ch) {
6042 case '#': 6044 case '#':
6043 if (dest.length == 0) { 6045 if (dest.length == 0) {
@@ -6061,12 +6063,17 @@ static struct pipe *parse_stream(char **pstring,
6061 ch = i_getch(input); 6063 ch = i_getch(input);
6062 if (ch != '\n') { 6064 if (ch != '\n') {
6063 o_addchr(&dest, '\\'); 6065 o_addchr(&dest, '\\');
6064 nommu_addchr(&ctx.as_string, '\\'); 6066 /*nommu_addchr(&ctx.as_string, '\\'); - already done */
6065 o_addchr(&dest, ch); 6067 o_addchr(&dest, ch);
6066 nommu_addchr(&ctx.as_string, ch); 6068 nommu_addchr(&ctx.as_string, ch);
6067 /* Example: echo Hello \2>file 6069 /* Example: echo Hello \2>file
6068 * we need to know that word 2 is quoted */ 6070 * we need to know that word 2 is quoted */
6069 dest.o_quoted = 1; 6071 dest.o_quoted = 1;
6072 } else {
6073#if !BB_MMU
6074 /* It's "\<newline>". Remove trailing '\' from ctx.as_string */
6075 ctx.as_string.data[--ctx.as_string.length] = '\0';
6076#endif
6070 } 6077 }
6071 break; 6078 break;
6072 case '$': 6079 case '$':