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>
}
USTPUTC(c, out);
nlprompt();
}
USTPUTC(c, out);
nlprompt();
+ c = synstack->syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
goto loop; /* continue outer loop */
case CWORD:
USTPUTC(c, out);
goto loop; /* continue outer loop */
case CWORD:
USTPUTC(c, out);
USTPUTC(CTLESC, out);
USTPUTC('\\', out);
pungetc();
USTPUTC(CTLESC, out);
USTPUTC('\\', out);
pungetc();
- } else if (c == '\n') {
- nlprompt();
} else {
if (pssyntax && c == '$') {
USTPUTC(CTLESC, out);
} else {
if (pssyntax && c == '$') {
USTPUTC(CTLESC, out);
IF_ASH_ALIAS(if (c != PEOA))
USTPUTC(c, out);
}
IF_ASH_ALIAS(if (c != PEOA))
USTPUTC(c, out);
}
+ c = synstack->syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
} /* for (;;) */
endword:
} /* for (;;) */
endword:
while (here) {
tokpushback = 0;
setprompt_if(needprompt, 2);
while (here) {
tokpushback = 0;
setprompt_if(needprompt, 2);
- readtoken1(pgetc(), here->here->type == NHERE ? SQSYNTAX : DQSYNTAX,
- here->eofmark, here->striptabs);
+ if (here->here->type == NHERE)
+ readtoken1(pgetc(), SQSYNTAX, here->eofmark, here->striptabs);
+ else
+ readtoken1(pgetc_eatbnl(), DQSYNTAX, here->eofmark, here->striptabs);
n = stzalloc(sizeof(struct narg));
n->narg.type = NARG;
/*n->narg.next = NULL; - stzalloc did it */
n = stzalloc(sizeof(struct narg));
n->narg.type = NARG;
/*n->narg.next = NULL; - stzalloc did it */