ash: use pgetc_eatbnl() in more places, take 2
Adding previously skipped "readtoken1(pgetc_eatbnl(), DQSYNTAX..." changes from upstream commit: Date: Thu Mar 8 08:37:11 2018 +0100 Author: Harald van Dijk <harald@gigawatt.nl> parser: use pgetc_eatbnl() in more places dash has a pgetc_eatbnl function in parser.c which skips any backslash-newline combinations. It's not used everywhere it could be. There is also some duplicated backslash-newline handling elsewhere in parser.c. Replace most of the calls to pgetc() with calls to pgetc_eatbnl() and remove the duplicated backslash-newline handling. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
a6e48dead3
commit
acf79f9913
12
shell/ash.c
12
shell/ash.c
@ -12194,7 +12194,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
|
|||||||
}
|
}
|
||||||
USTPUTC(c, out);
|
USTPUTC(c, out);
|
||||||
nlprompt();
|
nlprompt();
|
||||||
c = pgetc();
|
c = synstack->syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
|
||||||
goto loop; /* continue outer loop */
|
goto loop; /* continue outer loop */
|
||||||
case CWORD:
|
case CWORD:
|
||||||
USTPUTC(c, out);
|
USTPUTC(c, out);
|
||||||
@ -12226,8 +12226,6 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
|
|||||||
USTPUTC(CTLESC, out);
|
USTPUTC(CTLESC, out);
|
||||||
USTPUTC('\\', out);
|
USTPUTC('\\', out);
|
||||||
pungetc();
|
pungetc();
|
||||||
} else if (c == '\n') {
|
|
||||||
nlprompt();
|
|
||||||
} else {
|
} else {
|
||||||
if (pssyntax && c == '$') {
|
if (pssyntax && c == '$') {
|
||||||
USTPUTC(CTLESC, out);
|
USTPUTC(CTLESC, out);
|
||||||
@ -12347,7 +12345,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
|
|||||||
IF_ASH_ALIAS(if (c != PEOA))
|
IF_ASH_ALIAS(if (c != PEOA))
|
||||||
USTPUTC(c, out);
|
USTPUTC(c, out);
|
||||||
}
|
}
|
||||||
c = pgetc();
|
c = synstack->syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
|
||||||
} /* for (;;) */
|
} /* for (;;) */
|
||||||
endword:
|
endword:
|
||||||
|
|
||||||
@ -13093,8 +13091,10 @@ parseheredoc(void)
|
|||||||
while (here) {
|
while (here) {
|
||||||
tokpushback = 0;
|
tokpushback = 0;
|
||||||
setprompt_if(needprompt, 2);
|
setprompt_if(needprompt, 2);
|
||||||
readtoken1(pgetc(), here->here->type == NHERE ? SQSYNTAX : DQSYNTAX,
|
if (here->here->type == NHERE)
|
||||||
here->eofmark, here->striptabs);
|
readtoken1(pgetc(), SQSYNTAX, here->eofmark, here->striptabs);
|
||||||
|
else
|
||||||
|
readtoken1(pgetc_eatbnl(), DQSYNTAX, here->eofmark, here->striptabs);
|
||||||
n = stzalloc(sizeof(struct narg));
|
n = stzalloc(sizeof(struct narg));
|
||||||
n->narg.type = NARG;
|
n->narg.type = NARG;
|
||||||
/*n->narg.next = NULL; - stzalloc did it */
|
/*n->narg.next = NULL; - stzalloc did it */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user