Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh Cease "support" for <redirect> fn() { ...



details:   https://anonhg.NetBSD.org/src/rev/7dfab634b4e2
branches:  trunk
changeset: 344412:7dfab634b4e2
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 27 14:36:29 2016 +0000

description:
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@)

diffstat:

 bin/sh/parser.c |  13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

diffs (48 lines):

diff -r d0187b0e8567 -r 7dfab634b4e2 bin/sh/parser.c
--- a/bin/sh/parser.c   Sun Mar 27 14:35:30 2016 +0000
+++ b/bin/sh/parser.c   Sun Mar 27 14:36:29 2016 +0000
@@ -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 @@
 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 @@
 
        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 @@
                        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);



Home | Main Index | Thread Index | Old Index