aboutsummaryrefslogtreecommitdiffstats
path: root/awk.y
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:54:45 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:54:45 +0300
commitf20ab7c3039a4023f41372bfe4bde3b16d481df7 (patch)
tree4425de8c6177df655f165cb61d70d0acb5fdc968 /awk.y
parent6607eb3d5e40b98d2acc8f6b0d6a0b5a4b0f56bd (diff)
downloadegawk-f20ab7c3039a4023f41372bfe4bde3b16d481df7.tar.gz
egawk-f20ab7c3039a4023f41372bfe4bde3b16d481df7.tar.bz2
egawk-f20ab7c3039a4023f41372bfe4bde3b16d481df7.zip
Move to gawk-3.0.4.
Diffstat (limited to 'awk.y')
-rw-r--r--awk.y19
1 files changed, 14 insertions, 5 deletions
diff --git a/awk.y b/awk.y
index 1b9a89bf..93959e82 100644
--- a/awk.y
+++ b/awk.y
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -830,7 +830,9 @@ variable
{ $$ = variable($1, CAN_FREE, Node_var); }
| NAME '[' expression_list ']'
{
- if ($3->rnode == NULL) {
+ if ($3 == NULL) {
+ fatal("invalid subscript expression");
+ } else if ($3->rnode == NULL) {
$$ = node(variable($1, CAN_FREE, Node_var_array), Node_subscript, $3->lnode);
freenode($3);
} else
@@ -1169,7 +1171,8 @@ again:
warning("source file `%s' is empty", source);
}
}
- close(fd);
+ if (fileno(stdin) != fd) /* safety */
+ close(fd);
samefile = FALSE;
nextfile++;
if (lexeme)
@@ -1451,14 +1454,17 @@ retry:
case ':':
case '?':
allow_newline();
- /* fall through */
+ return lasttok = c;
+
case ')':
case ']':
case '(':
- case '[':
case ';':
case '{':
case ',':
+ want_assign = FALSE;
+ /* fall through */
+ case '[':
return lasttok = c;
case '*':
@@ -2109,6 +2115,9 @@ NODE *list, *new;
register NODE *oldlist;
static NODE *savefront = NULL, *savetail = NULL;
+ if (list == NULL || new == NULL)
+ return list;
+
oldlist = list;
if (savefront == oldlist) {
savetail = savetail->rnode = new;