diff options
| author | Jilles Tjoelker <jilles@FreeBSD.org> | 2015-09-30 21:32:29 +0000 |
|---|---|---|
| committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2015-09-30 21:32:29 +0000 |
| commit | d358fa780b338913419f028acdf62896e2481d97 (patch) | |
| tree | c0c8b623265338ef1866c1e7413af3622fae0154 /bin/sh/parser.c | |
| parent | 24df1f7e7f1350fc9e5fad127ed6dcf847e6b0b8 (diff) | |
Notes
Diffstat (limited to 'bin/sh/parser.c')
| -rw-r--r-- | bin/sh/parser.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 302d1797c194..53d7923f8755 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -231,6 +231,39 @@ parsecmd(int interact) } +/* + * Read and parse words for wordexp. + * Returns a list of NARG nodes; NULL if there are no words. + */ +union node * +parsewordexp(void) +{ + union node *n, *first = NULL, **pnext; + int t; + + /* This assumes the parser is not re-entered, + * which could happen if we add command substitution on PS1/PS2. + */ + parser_temp_free_all(); + heredoclist = NULL; + + tokpushback = 0; + checkkwd = 0; + doprompt = 0; + setprompt(0); + needprompt = 0; + pnext = &first; + while ((t = readtoken()) != TEOF) { + if (t != TWORD) + synexpect(TWORD); + n = makename(); + *pnext = n; + pnext = &n->narg.next; + } + return first; +} + + static union node * list(int nlflag) { |
