summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/parse.c19
-rw-r--r--Test/A04redirect.ztst12
3 files changed, 30 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 112a53d1a..8ac6df15e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2017-05-08 Peter Stephenson <p.stephenson@samsung.com>
+ * users/22688: Src/parse.c, Test/A04redirect.ztst: Allow mixing
+ of redirections and arguments after anonymous functions.
+
* 41060: Src/parse.c, Test/A04redirect.ztst: combination
of HERE document and |& was broken by miscounting wordcode owing
to missing flag.
diff --git a/Src/parse.c b/Src/parse.c
index 83e87afed..b0de9a863 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2030,10 +2030,21 @@ par_simple(int *cmplx, int nr)
/* Unnamed function */
int parg = ecadd(0);
ecadd(0);
- while (tok == STRING) {
- ecstr(tokstr);
- argc++;
- zshlex();
+ while (tok == STRING || IS_REDIROP(tok)) {
+ if (tok == STRING)
+ {
+ ecstr(tokstr);
+ argc++;
+ zshlex();
+ } else {
+ *cmplx = c = 1;
+ nrediradd = par_redir(&r, NULL);
+ p += nrediradd;
+ if (ppost)
+ ppost += nrediradd;
+ sr += nrediradd;
+ parg += nrediradd;
+ }
}
if (argc > 0)
*cmplx = 1;
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
index a5de552c1..2671080c2 100644
--- a/Test/A04redirect.ztst
+++ b/Test/A04redirect.ztst
@@ -475,6 +475,18 @@
>Nothing output yet
>I just read any old rubbish
+ print you cannot be serious >input1
+ () {
+ local var
+ read var
+ print $1 $var $2
+ } <input1 Shirley >output1 dude
+ print Nothing output yet
+ cat output1
+0:anonymous function redirections mixed with argument
+>Nothing output yet
+>Shirley you cannot be serious dude
+
redirfn() {
local var
read var