hush: fix \<newline> handling on NOMMU
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
19679784c0
commit
cbfe6ad4c6
@ -6038,6 +6038,8 @@ static struct pipe *parse_stream(char **pstring,
|
|||||||
dest.o_assignment = NOT_ASSIGNMENT;
|
dest.o_assignment = NOT_ASSIGNMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Note: nommu_addchr(&ctx.as_string, ch) is already done */
|
||||||
|
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case '#':
|
case '#':
|
||||||
if (dest.length == 0) {
|
if (dest.length == 0) {
|
||||||
@ -6061,12 +6063,17 @@ static struct pipe *parse_stream(char **pstring,
|
|||||||
ch = i_getch(input);
|
ch = i_getch(input);
|
||||||
if (ch != '\n') {
|
if (ch != '\n') {
|
||||||
o_addchr(&dest, '\\');
|
o_addchr(&dest, '\\');
|
||||||
nommu_addchr(&ctx.as_string, '\\');
|
/*nommu_addchr(&ctx.as_string, '\\'); - already done */
|
||||||
o_addchr(&dest, ch);
|
o_addchr(&dest, ch);
|
||||||
nommu_addchr(&ctx.as_string, ch);
|
nommu_addchr(&ctx.as_string, ch);
|
||||||
/* Example: echo Hello \2>file
|
/* Example: echo Hello \2>file
|
||||||
* we need to know that word 2 is quoted */
|
* we need to know that word 2 is quoted */
|
||||||
dest.o_quoted = 1;
|
dest.o_quoted = 1;
|
||||||
|
} else {
|
||||||
|
#if !BB_MMU
|
||||||
|
/* It's "\<newline>". Remove trailing '\' from ctx.as_string */
|
||||||
|
ctx.as_string.data[--ctx.as_string.length] = '\0';
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '$':
|
case '$':
|
||||||
|
7
shell/hush_test/hush-misc/nommu1.right
Normal file
7
shell/hush_test/hush-misc/nommu1.right
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Ok
|
||||||
|
Ok
|
||||||
|
Ok
|
||||||
|
Ok
|
||||||
|
Ok
|
||||||
|
Ok
|
||||||
|
Done
|
12
shell/hush_test/hush-misc/nommu1.tests
Executable file
12
shell/hush_test/hush-misc/nommu1.tests
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
(echo \
|
||||||
|
Ok)
|
||||||
|
( (echo \
|
||||||
|
Ok) )
|
||||||
|
( ( (echo \
|
||||||
|
Ok) ) )
|
||||||
|
|
||||||
|
(echo \Ok)
|
||||||
|
( (echo \Ok) )
|
||||||
|
( ( (echo \Ok) ) )
|
||||||
|
|
||||||
|
echo Done
|
Loading…
Reference in New Issue
Block a user