zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: time time
@ 2000-06-14  9:25 Sven Wischnowsky
  0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 2000-06-14  9:25 UTC (permalink / raw)
  To: zsh-workers


[ sunsite sleeping again, great ]

Just found this on the Debian bug list...

Doing `time time' can be deadly. The problem is that it can't handle
time-in-a-time, but it still takes the second `time' as a special
token.

Dunno if this fix is correct, it makes the second `time' be taken as a 
command name. At least it fixes the bug and trying to measure the
execution time of `time' without a command doesn't make sense
anyway. We could also make it report an error (bash does that, ksh
reports the times of `time' without arguments (hm) and the DU sh does
what zsh does with this patch -- measure execution times of the
external command `time').

Bye
 Sven

Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.8
diff -u -r1.8 parse.c
--- Src/parse.c	2000/05/27 08:32:58	1.8
+++ Src/parse.c	2000/06/14 09:23:30
@@ -799,10 +799,6 @@
 	par_funcdef();
 	cmdpop();
 	break;
-    case TIME:
-	*complex = 1;
-	par_time();
-	break;
     case DINBRACK:
 	cmdpush(CS_COND);
 	par_dinbrack();
@@ -813,6 +809,20 @@
 	ecstr(tokstr);
 	yylex();
 	break;
+    case TIME:
+	{
+	    static int inpartime = 0;
+
+	    if (!inpartime) {
+		*complex = 1;
+		inpartime = 1;
+		par_time();
+		inpartime = 0;
+		break;
+	    }
+	}
+	tok = STRING;
+	/* fall through */
     default:
 	{
 	    int sr;

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-06-14  9:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-14  9:25 PATCH: time time Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).