about summary refs log tree commit diff
path: root/Src/lex.c
diff options
context:
space:
mode:
authorAndrew Main <zefram@users.sourceforge.net>2000-04-06 17:21:52 +0000
committerAndrew Main <zefram@users.sourceforge.net>2000-04-06 17:21:52 +0000
commit181811bf80eaa7c11e3d465c33ce5c9ed4e0415d (patch)
tree4056282129990f2af12ee97399f61a25c41c7c1c /Src/lex.c
parent84e12c1caa116e69f9c0f9d88a3034da23882eda (diff)
downloadzsh-181811bf80eaa7c11e3d465c33ce5c9ed4e0415d.tar.gz
zsh-181811bf80eaa7c11e3d465c33ce5c9ed4e0415d.tar.xz
zsh-181811bf80eaa7c11e3d465c33ce5c9ed4e0415d.zip
zefram2: Src/lex.c: Support "3&> foo" etc.
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Src/lex.c b/Src/lex.c
index 2c19c097e..ccd04b2d9 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -642,7 +642,18 @@ gettok(void)
 	return DOUTPAR;
     } else if (idigit(c)) {	/* handle 1< foo */
 	d = hgetc();
-	if (d == '>' || d == '<') {
+	if(d == '&') {
+	    d = hgetc();
+	    if(d == '>') {
+		peekfd = c - '0';
+		hungetc('>');
+		c = '&';
+	    } else {
+		hungetc(d);
+		lexstop = 0;
+		hungetc('&');
+	    }
+	} else if (d == '>' || d == '<') {
 	    peekfd = c - '0';
 	    c = d;
 	} else {
@@ -702,6 +713,7 @@ gettok(void)
 	else if (d == '!' || d == '|')
 	    return AMPERBANG;
 	else if (d == '>') {
+	    tokfd = peekfd;
 	    d = hgetc();
 	    if (d == '!' || d == '|')
 		return OUTANGAMPBANG;
@@ -715,7 +727,6 @@ gettok(void)
 	    }
 	    hungetc(d);
 	    lexstop = 0;
-	    tokfd = -1;
 	    return AMPOUTANG;
 	}
 	hungetc(d);