about summary refs log tree commit diff
path: root/Src/hist.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2002-03-24 23:52:47 +0000
committerWayne Davison <wayned@users.sourceforge.net>2002-03-24 23:52:47 +0000
commitcbc7abb006e55a42f65489332b650b24e2ee7d4b (patch)
treeb2ffc1b2e2af73fb0184423dd992f1d395fc98a4 /Src/hist.c
parent18b090df5a50847ae050488493b79b143041dcfe (diff)
downloadzsh-cbc7abb006e55a42f65489332b650b24e2ee7d4b.tar.gz
zsh-cbc7abb006e55a42f65489332b650b24e2ee7d4b.tar.xz
zsh-cbc7abb006e55a42f65489332b650b24e2ee7d4b.zip
Added "savehistsiz" (for the new SAVEHIST special parameter), and used it
in place of getiparam("SAVEHIST").
Diffstat (limited to 'Src/hist.c')
-rw-r--r--Src/hist.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/Src/hist.c b/Src/hist.c
index 492c876ec..0b9bf2c17 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -101,6 +101,11 @@ mod_export Histent hist_ring;
 /**/
 int histsiz;
  
+/* desired history-file size (in lines) */
+ 
+/**/
+int savehistsiz;
+ 
 /* if = 1, we have performed history substitution on the current line *
  * if = 2, we have used the 'p' modifier                              */
  
@@ -922,7 +927,7 @@ putoldhistentryontop(short keep_going)
     if (isset(HISTEXPIREDUPSFIRST) && !(he->flags & HIST_DUP)) {
 	static int max_unique_ct = 0;
 	if (!keep_going)
-	    max_unique_ct = getiparam("SAVEHIST");
+	    max_unique_ct = savehistsiz;
 	do {
 	    if (max_unique_ct-- <= 0 || he == hist_ring) {
 		max_unique_ct = 0;
@@ -1984,10 +1989,9 @@ savehistfile(char *fn, int err, int writeflags)
     FILE *out;
     Histent he;
     int xcurhist = curhist - !!(histactive & HA_ACTIVE);
-    int savehist = getiparam("SAVEHIST");
     int extended_history = isset(EXTENDEDHISTORY);
 
-    if (!interact || savehist <= 0 || !hist_ring
+    if (!interact || savehistsiz <= 0 || !hist_ring
      || (!fn && !(fn = getsparam("HISTFILE"))))
 	return;
     if (writeflags & HFILE_FAST) {
@@ -1998,7 +2002,7 @@ savehistfile(char *fn, int err, int writeflags)
 	}
 	if (!he || !lockhistfile(fn, 0))
 	    return;
-	if (histfile_linect > savehist + savehist / 5)
+	if (histfile_linect > savehistsiz + savehistsiz / 5)
 	    writeflags &= ~HFILE_FAST;
     }
     else {
@@ -2079,7 +2083,7 @@ savehistfile(char *fn, int err, int writeflags)
 
 	    hist_ring = NULL;
 	    curhist = histlinect = 0;
-	    histsiz = savehist;
+	    histsiz = savehistsiz;
 	    histactive = 0;
 	    createhisttable(); /* sets histtab */