summaryrefslogtreecommitdiffstats
path: root/bin/sh/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/parser.c')
-rw-r--r--bin/sh/parser.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 2687003..f883dff 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -389,8 +389,10 @@ command(void)
union node *cp, **cpp;
union node *redir, **rpp;
int t;
+ int is_subshell;
checkkwd = CHKNL | CHKKWD | CHKALIAS;
+ is_subshell = 0;
redir = NULL;
n1 = NULL;
rpp = &redir;
@@ -558,6 +560,7 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
if (readtoken() != TRP)
synexpect(TRP);
checkkwd = CHKKWD | CHKALIAS;
+ is_subshell = 1;
break;
case TBEGIN:
n1 = list(0, 0);
@@ -596,7 +599,7 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
tokpushback++;
*rpp = NULL;
if (redir) {
- if (n1->type != NSUBSHELL) {
+ if (!is_subshell) {
n2 = (union node *)stalloc(sizeof (struct nredir));
n2->type = NREDIR;
n2->nredir.n = n1;
@@ -887,8 +890,6 @@ xxreadtoken(void)
startlinno = plinno;
for (;;) { /* until token or start of word found */
c = pgetc_macro();
- if (c == ' ' || c == '\t')
- continue; /* quick check for white space first */
switch (c) {
case ' ': case '\t':
continue;
@@ -1095,9 +1096,8 @@ done:
popfile();
tokpushback = 0;
}
- while (stackblocksize() <= savelen)
- growstackblock();
STARTSTACKSTR(out);
+ CHECKSTRSPACE(savelen + 1, out);
INTOFF;
if (str) {
memcpy(out, str, savelen);
OpenPOWER on IntegriCloud