From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15586 invoked from network); 13 Sep 2001 18:38:34 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Sep 2001 18:38:34 -0000 Received: (qmail 12870 invoked by alias); 13 Sep 2001 18:38:27 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15806 Received: (qmail 12857 invoked from network); 13 Sep 2001 18:38:26 -0000 Date: Thu, 13 Sep 2001 11:37:58 -0700 (PDT) From: Wayne Davison X-X-Sender: To: Bart Schaefer Cc: Subject: Re: r problem In-Reply-To: <1010912160325.ZM25844@candle.brasslantern.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 12 Sep 2001, Bart Schaefer wrote: > This looks like a bug in gethistent(). It was actually a problem with addhistnum() in how it was choosing to return boundary values. I changed this, and then checked everything that was calling addhistnum() to ensure that they should be able to handle the new behavior. > Another bug (?) is that the "r" command itself gets entered in the history > even when hist_no_store is set. Yes, I hadn't remembered to add that to the hist_no_store check. > On the other hand, "history" and "fc" get left out of the history with > hist_no_store even when they've been redefined as functions that have > nothing to do with the history. They are no longer omitted if you alias them, so that is a better way to go at the moment. With the advent of my HIST_TMPSTORE flag, I could change the builtins to set this value and get rid of the command-line scan. I'll look into this later to see if I think this is a good idea. ..wayne.. ---8<------8<------8<------8<---cut here--->8------>8------>8------>8--- Index: Src/builtin.c --- Src/builtin.c 2001/08/13 17:43:04 1.51 +++ Src/builtin.c 2001/09/13 18:12:12 @@ -1299,8 +1299,8 @@ if (last == -1) last = ops['l']? addhistnum(curline.histnum,-1,0) : first; if (first < firsthist()) - first = firsthist(); - if (last == -1) + first = firsthist() - (first == last); + if (last > curhist) last = (minflag) ? curhist : first; else if (last < first) last = first; @@ -1368,7 +1368,7 @@ if ((cmd = atoi(s))) { if (cmd < 0) cmd = addhistnum(curline.histnum,cmd,HIST_FOREIGN); - if (cmd >= curline.histnum) { + if (cmd < firsthist()) { zwarnnam("fc", "bad history number: %d", 0, cmd); return -1; } Index: Src/hist.c --- Src/hist.c 2001/08/07 19:53:19 1.31 +++ Src/hist.c 2001/09/13 18:12:13 @@ -845,7 +845,7 @@ if (n) he = movehistent(he, n, xflags); if (!he) - return dir < 0? firsthist() : curhist; + return dir < 0? firsthist() - 1 : curhist + 1; return he->histnum; } @@ -993,6 +993,8 @@ b += 8; if (*b == 'h' && strncmp(b, "history", 7) == 0 && (!b[7] || b[7] == ' ')) + return 1; + if (*b == 'r' && (!b[1] || b[1] == ' ')) return 1; if (*b == 'f' && b[1] == 'c' && b[2] == ' ' && b[3] == '-') { b += 3; ---8<------8<------8<------8<---cut here--->8------>8------>8------>8---