From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4729 invoked from network); 14 Jun 2000 09:27:26 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 14 Jun 2000 09:27:26 -0000 Received: (qmail 10136 invoked by alias); 14 Jun 2000 09:26:28 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11885 Received: (qmail 10123 invoked from network); 14 Jun 2000 09:26:27 -0000 Date: Wed, 14 Jun 2000 11:25:27 +0200 (MET DST) Message-Id: <200006140925.LAA19343@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk Subject: PATCH: time time [ 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