summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-07-21 07:50:07 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-07-21 07:50:07 +0000
commit6585bea1fbe7da57adfa0f57b1bf2f98bb91a911 (patch)
tree9e47c96eda9d66dcaf18ec59aaf7ad268823745f
parentea8d99e102960a5ce560ac783c06a7acc5ac716e (diff)
downloadzsh-6585bea1fbe7da57adfa0f57b1bf2f98bb91a911.tar.gz
zsh-6585bea1fbe7da57adfa0f57b1bf2f98bb91a911.tar.xz
zsh-6585bea1fbe7da57adfa0f57b1bf2f98bb91a911.zip
fix parsing of `time' without a command (12337)
-rw-r--r--ChangeLog4
-rw-r--r--Src/parse.c10
2 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 36fdc903c..976d8f4bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2000-07-21  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 12337: Src/parse.c: fix parsing of `time' without a command
+	
 2000-07-20  Wayne Davison  <wayned@users.sourceforge.net>
 
 	* unposted: tweaked a function name in hist.c for Sven.
diff --git a/Src/parse.c b/Src/parse.c
index a8b33f35c..ddeb5e529 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -1389,9 +1389,13 @@ par_time(void)
 
     p = ecadd(0);
     ecadd(0);
-    f = par_sublist2(&c);
-    ecbuf[p] = WCB_TIMED((p + 1 == ecused) ? WC_TIMED_EMPTY : WC_TIMED_PIPE);
-    set_sublist_code(p + 1, WC_SUBLIST_END, f, ecused - 2 - p, c);
+    if ((f = par_sublist2(&c)) < 0) {
+	ecused--;
+	ecbuf[p] = WCB_TIMED(WC_TIMED_EMPTY);
+    } else {
+	ecbuf[p] = WCB_TIMED(WC_TIMED_PIPE);
+	set_sublist_code(p + 1, WC_SUBLIST_END, f, ecused - 2 - p, c);
+    }
 }
 
 /*