Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: history problems
- X-seq: zsh-workers 15819
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Vin Shelton <acs@xxxxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxx
- Subject: Re: history problems
- Date: Sun, 16 Sep 2001 21:31:20 +0000
- In-reply-to: <m2adzvrofq.fsf@xxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <m2adzvrofq.fsf@xxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author