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.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 192769b..151970b 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -619,6 +619,7 @@ simplecmd(union node **rpp, union node *redir)
union node **orig_rpp = rpp;
union node *n = NULL;
int special;
+ int savecheckkwd;
/* If we don't have any redirections already, then we must reset */
/* rpp to be the address of the local redir variable. */
@@ -634,7 +635,10 @@ simplecmd(union node **rpp, union node *redir)
*/
orig_rpp = rpp;
+ savecheckkwd = CHKALIAS;
+
for (;;) {
+ checkkwd = savecheckkwd;
if (readtoken() == TWORD) {
n = (union node *)stalloc(sizeof (struct narg));
n->type = NARG;
@@ -642,6 +646,8 @@ simplecmd(union node **rpp, union node *redir)
n->narg.backquote = backquotelist;
*app = n;
app = &n->narg.next;
+ if (savecheckkwd != 0 && !isassignment(wordtext))
+ savecheckkwd = 0;
} else if (lasttoken == TREDIR) {
*rpp = n = redirnode;
rpp = &n->nfile.next;
@@ -1859,6 +1865,22 @@ goodname(const char *name)
}
+int
+isassignment(const char *p)
+{
+ if (!is_name(*p))
+ return 0;
+ p++;
+ for (;;) {
+ if (*p == '=')
+ return 1;
+ else if (!is_in_name(*p))
+ return 0;
+ p++;
+ }
+}
+
+
/*
* Called when an unexpected token is read during the parse. The argument
* is the token that is expected, or -1 if more than one type of token can
OpenPOWER on IntegriCloud