hush: probably fixing a bug in last LINENO fix

I don't have an example of mishandled script, but the logic looked wrong:
it could sometimes treat newlines as if they are spaces.

function                                             old     new   delta
parse_stream                                        2788    2787      -1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2018-02-08 19:39:42 +01:00
parent 5807e18f0c
commit f786901c4b

View File

@ -5019,18 +5019,13 @@ static struct pipe *parse_stream(char **pstring,
* i.e., at the previous line. * i.e., at the previous line.
* We need to skip all whitespace before newlines. * We need to skip all whitespace before newlines.
*/ */
if (ch != '\n') { while (ch != '\n') {
/* It was whitespace, but not a newline. next = i_peek(input);
* Eat all whitespace. if (next != ' ' && next != '\t' && next != '\n')
*/ break; /* next char is not ws */
for (;;) { ch = i_getch(input);
next = i_peek(input);
if (next != ' ' && next != '\t' && next != '\n')
break; /* next char is not ws */
ch = i_getch(input);
}
/* ch == last eaten whitespace char */
} }
/* ch == last eaten whitespace char */
#endif #endif
if (done_word(&dest, &ctx)) { if (done_word(&dest, &ctx)) {
goto parse_error; goto parse_error;