summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/sh/parser.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 067faa7..c8ea376 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: parser.c,v 1.8 1995/08/27 20:26:42 joerg Exp $
+ * $Id: parser.c,v 1.9 1995/08/28 19:24:35 joerg Exp $
*/
#ifndef lint
@@ -149,30 +149,13 @@ list(nlflag) {
n1 = andor();
for (;;) {
switch (readtoken()) {
- case TBACKGND:
- if (n1->type == NCMD || n1->type == NPIPE) {
- n1->ncmd.backgnd = 1;
- } else if (n1->type == NREDIR) {
- n1->type = NBACKGND;
- } else {
- n3 = (union node *)stalloc(sizeof (struct nredir));
- n3->type = NBACKGND;
- n3->nredir.n = n1;
- n3->nredir.redirect = NULL;
- n1 = n3;
- }
- goto tsemi;
case TNL:
- tokpushback++;
+ parseheredoc();
+ if (nlflag)
+ return n1;
/* fall through */
-tsemi: case TSEMI:
- if (readtoken() == TNL) {
- parseheredoc();
- if (nlflag)
- return n1;
- } else {
- tokpushback++;
- }
+ case TBACKGND:
+ case TSEMI:
checkkwd = 2;
if (tokendlist[peektoken()])
return n1;
@@ -212,6 +195,19 @@ andor() {
} else if (t == TOR) {
t = NOR;
} else {
+ if (t == TBACKGND) {
+ if (n1->type == NCMD || n1->type == NPIPE) {
+ n1->ncmd.backgnd = 1;
+ } else if (n1->type == NREDIR) {
+ n1->type = NBACKGND;
+ } else {
+ n3 = (union node *)stalloc(sizeof (struct nredir));
+ n3->type = NBACKGND;
+ n3->nredir.n = n1;
+ n3->nredir.redirect = NULL;
+ n1 = n3;
+ }
+ }
tokpushback++;
return n1;
}
OpenPOWER on IntegriCloud