From cbc7abb006e55a42f65489332b650b24e2ee7d4b Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sun, 24 Mar 2002 23:52:47 +0000 Subject: Added "savehistsiz" (for the new SAVEHIST special parameter), and used it in place of getiparam("SAVEHIST"). --- Src/hist.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'Src/hist.c') 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 */ -- cgit 1.4.1