View | Details | Raw Unified | Return to bug 880 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/src/bin/sh/parser.c (-22 / +18 lines)
Lines 149-178 Link Here
149
	n1 = andor();
149
	n1 = andor();
150
	for (;;) {
150
	for (;;) {
151
		switch (readtoken()) {
151
		switch (readtoken()) {
152
		case TBACKGND:
153
			if (n1->type == NCMD || n1->type == NPIPE) {
154
				n1->ncmd.backgnd = 1;
155
			} else if (n1->type == NREDIR) {
156
				n1->type = NBACKGND;
157
			} else {
158
				n3 = (union node *)stalloc(sizeof (struct nredir));
159
				n3->type = NBACKGND;
160
				n3->nredir.n = n1;
161
				n3->nredir.redirect = NULL;
162
				n1 = n3;
163
			}
164
			goto tsemi;
165
		case TNL:
152
		case TNL:
166
			tokpushback++;
153
			parseheredoc();
154
			if (nlflag)
155
				return n1;
167
			/* fall through */
156
			/* fall through */
168
tsemi:	    case TSEMI:
157
		case TBACKGND:
169
			if (readtoken() == TNL) {
158
		case TSEMI:
170
				parseheredoc();
171
				if (nlflag)
172
					return n1;
173
			} else {
174
				tokpushback++;
175
			}
176
			checkkwd = 2;
159
			checkkwd = 2;
177
			if (tokendlist[peektoken()])
160
			if (tokendlist[peektoken()])
178
				return n1;
161
				return n1;
Lines 212-217 Link Here
212
		} else if (t == TOR) {
195
		} else if (t == TOR) {
213
			t = NOR;
196
			t = NOR;
214
		} else {
197
		} else {
198
			if (t == TBACKGND) {
199
				if (n1->type == NCMD || n1->type == NPIPE) {
200
					n1->ncmd.backgnd = 1;
201
				} else if (n1->type == NREDIR) {
202
					n1->type = NBACKGND;
203
				} else {
204
					n3 = (union node *)stalloc(sizeof (struct nredir));
205
					n3->type = NBACKGND;
206
					n3->nredir.n = n1;
207
					n3->nredir.redirect = NULL;
208
					n1 = n3;
209
				}
210
			}
215
			tokpushback++;
211
			tokpushback++;
216
			return n1;
212
			return n1;
217
		}
213
		}

Return to bug 880