aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-02-14 16:12:06 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-02-16 19:14:45 +0100
commitacf79f9913e4cf9b2889404af6758ec8a0d6b090 (patch)
tree3e789b542f3d31965ead486f2149f455c10cb717 /shell/ash.c
parenta6e48dead331c3c19e070992d2d571e74a1d9a8d (diff)
downloadbusybox-w32-acf79f9913e4cf9b2889404af6758ec8a0d6b090.tar.gz
busybox-w32-acf79f9913e4cf9b2889404af6758ec8a0d6b090.tar.bz2
busybox-w32-acf79f9913e4cf9b2889404af6758ec8a0d6b090.zip
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>
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/shell/ash.c b/shell/ash.c
index fb4028219..c177ac038 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12194,7 +12194,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
12194 } 12194 }
12195 USTPUTC(c, out); 12195 USTPUTC(c, out);
12196 nlprompt(); 12196 nlprompt();
12197 c = pgetc(); 12197 c = synstack->syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
12198 goto loop; /* continue outer loop */ 12198 goto loop; /* continue outer loop */
12199 case CWORD: 12199 case CWORD:
12200 USTPUTC(c, out); 12200 USTPUTC(c, out);
@@ -12226,8 +12226,6 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
12226 USTPUTC(CTLESC, out); 12226 USTPUTC(CTLESC, out);
12227 USTPUTC('\\', out); 12227 USTPUTC('\\', out);
12228 pungetc(); 12228 pungetc();
12229 } else if (c == '\n') {
12230 nlprompt();
12231 } else { 12229 } else {
12232 if (pssyntax && c == '$') { 12230 if (pssyntax && c == '$') {
12233 USTPUTC(CTLESC, out); 12231 USTPUTC(CTLESC, out);
@@ -12347,7 +12345,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
12347 IF_ASH_ALIAS(if (c != PEOA)) 12345 IF_ASH_ALIAS(if (c != PEOA))
12348 USTPUTC(c, out); 12346 USTPUTC(c, out);
12349 } 12347 }
12350 c = pgetc(); 12348 c = synstack->syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
12351 } /* for (;;) */ 12349 } /* for (;;) */
12352 endword: 12350 endword:
12353 12351
@@ -13093,8 +13091,10 @@ parseheredoc(void)
13093 while (here) { 13091 while (here) {
13094 tokpushback = 0; 13092 tokpushback = 0;
13095 setprompt_if(needprompt, 2); 13093 setprompt_if(needprompt, 2);
13096 readtoken1(pgetc(), here->here->type == NHERE ? SQSYNTAX : DQSYNTAX, 13094 if (here->here->type == NHERE)
13097 here->eofmark, here->striptabs); 13095 readtoken1(pgetc(), SQSYNTAX, here->eofmark, here->striptabs);
13096 else
13097 readtoken1(pgetc_eatbnl(), DQSYNTAX, here->eofmark, here->striptabs);
13098 n = stzalloc(sizeof(struct narg)); 13098 n = stzalloc(sizeof(struct narg));
13099 n->narg.type = NARG; 13099 n->narg.type = NARG;
13100 /*n->narg.next = NULL; - stzalloc did it */ 13100 /*n->narg.next = NULL; - stzalloc did it */