From: Bart Schaefer <schaefer@brasslantern.com>
To: Vin Shelton <acs@alumni.princeton.edu>, zsh-workers@sunsite.dk
Subject: Re: history problems
Date: Sun, 16 Sep 2001 21:31:20 +0000 [thread overview]
Message-ID: <1010916213120.ZM4318@candle.brasslantern.com> (raw)
In-Reply-To: <m2adzvrofq.fsf@zion.rcn.com>
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
next prev parent reply other threads:[~2001-09-16 21:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-16 18:16 Vin Shelton
2001-09-16 21:31 ` Bart Schaefer [this message]
2001-09-17 17:56 ` Wayne Davison
2001-09-18 2:24 ` Vin Shelton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1010916213120.ZM4318@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=acs@alumni.princeton.edu \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).