From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29046 invoked from network); 16 Sep 2001 21:31:36 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 16 Sep 2001 21:31:36 -0000 Received: (qmail 26758 invoked by alias); 16 Sep 2001 21:31:29 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15819 Received: (qmail 26747 invoked from network); 16 Sep 2001 21:31:28 -0000 From: Bart Schaefer Message-Id: <1010916213120.ZM4318@candle.brasslantern.com> Date: Sun, 16 Sep 2001 21:31:20 +0000 In-Reply-To: Comments: In reply to Vin Shelton "history problems" (Sep 16, 2:16pm) References: X-Mailer: Z-Mail (5.0.0 30July97) To: Vin Shelton , zsh-workers@sunsite.dk Subject: Re: history problems MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 16, 2:16pm, Vin Shelton wrote: } } zion% history } 1 ls } zion% history -100 } fc: bad history number: 0 This is an unintended side-effect of Wayne's patch in 15806. One possible fix is appended; Wayne may have a better idea. Even with this patch, `curline.histnum' appears occasionally to be wrong: schaefer<507> fc -l -1 506 506 h schaefer<508> fc -l -1 508 fc: bad history number: 508 schaefer<509> fc -l -1 508 fc: bad history number: 508 The second of those should have succeeded, I think. Index: Src/builtin.c =================================================================== diff -c -r1.7 builtin.c --- Src/builtin.c 2001/09/15 19:16:25 1.7 +++ Src/builtin.c 2001/09/16 21:27:59 @@ -1268,7 +1268,7 @@ /* interpret and check first history line specifier */ if (*argv) { minflag = **argv == '-'; - first = fcgetcomm(*argv); + first = fcgetcomm(*argv, ops); if (first == -1) { unqueue_signals(); return 1; @@ -1277,7 +1277,7 @@ } /* interpret and check second history line specifier */ if (*argv) { - last = fcgetcomm(*argv); + last = fcgetcomm(*argv, ops); if (last == -1) { unqueue_signals(); return 1; @@ -1359,7 +1359,7 @@ /**/ static int -fcgetcomm(char *s) +fcgetcomm(char *s, char *ops) { int cmd; @@ -1368,7 +1368,7 @@ if ((cmd = atoi(s))) { if (cmd < 0) cmd = addhistnum(curline.histnum,cmd,HIST_FOREIGN); - if (cmd < firsthist()) { + if (cmd >= curline.histnum || (!ops['l'] && cmd < firsthist())) { zwarnnam("fc", "bad history number: %d", 0, cmd); return -1; } -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net