Module Name: src
Committed By: christos
Date: Sun Mar 27 14:36:29 UTC 2016
Modified Files:
src/bin/sh: parser.c
Log Message:
Cease "support" for <redirect> fn() { ...
Any redirect (or redirects) before a function definition were
allowed by the parser, but otherwise totally ignored. The standard
syntax does not permit redirects there, now, neither do we. (from kre@)
To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/bin/sh/parser.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.109 src/bin/sh/parser.c:1.110
--- src/bin/sh/parser.c:1.109 Sun Mar 27 10:35:30 2016
+++ src/bin/sh/parser.c Sun Mar 27 10:36:29 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: parser.c,v 1.109 2016/03/27 14:35:30 christos Exp $ */
+/* $NetBSD: parser.c,v 1.110 2016/03/27 14:36:29 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95";
#else
-__RCSID("$NetBSD: parser.c,v 1.109 2016/03/27 14:35:30 christos Exp $");
+__RCSID("$NetBSD: parser.c,v 1.110 2016/03/27 14:36:29 christos Exp $");
#endif
#endif /* not lint */
@@ -560,7 +560,6 @@ STATIC union node *
simplecmd(union node **rpp, union node *redir)
{
union node *args, **app;
- union node **orig_rpp = rpp;
union node *n = NULL, *n2;
int negate = 0;
@@ -571,12 +570,6 @@ simplecmd(union node **rpp, union node *
args = NULL;
app = &args;
- /*
- * We save the incoming value, because we need this for shell
- * functions. There can not be a redirect or an argument between
- * the function name and the open parenthesis.
- */
- orig_rpp = rpp;
while (readtoken() == TNOT) {
TRACE(("simplcmd: TNOT recognized\n"));
@@ -597,7 +590,7 @@ simplecmd(union node **rpp, union node *
rpp = &n->nfile.next;
parsefname(); /* read name of redirection file */
} else if (lasttoken == TLP && app == &args->narg.next
- && rpp == orig_rpp) {
+ && redir == 0) {
/* We have a function */
if (readtoken() != TRP)
synexpect(TRP, 0);