diff options
author | Fridolin Pokorny <fpokorny@redhat.com> | 2013-03-28 13:22:02 +0100 |
---|---|---|
committer | Fridolin Pokorny <fpokorny@redhat.com> | 2013-03-28 13:22:02 +0100 |
commit | bed5d53e2507471a02fbec9aa0467c50bb3ad0d5 (patch) | |
tree | faedd290e84179ae8037b7fca779c2709df29114 /tcsh-6.18.00-history-savehist.patch | |
parent | f379b9341b36f8053316fa1609a1c234473737c5 (diff) | |
download | tcsh-rebase-6.19.00-bed5d53e2507471a02fbec9aa0467c50bb3ad0d5.tar.gz tcsh-rebase-6.19.00-bed5d53e2507471a02fbec9aa0467c50bb3ad0d5.tar.xz tcsh-rebase-6.19.00-bed5d53e2507471a02fbec9aa0467c50bb3ad0d5.zip |
Fix history problems (#879371 and #919452), histlist length reflects $savehist
Diffstat (limited to 'tcsh-6.18.00-history-savehist.patch')
-rw-r--r-- | tcsh-6.18.00-history-savehist.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tcsh-6.18.00-history-savehist.patch b/tcsh-6.18.00-history-savehist.patch new file mode 100644 index 0000000..b2178ba --- /dev/null +++ b/tcsh-6.18.00-history-savehist.patch @@ -0,0 +1,55 @@ +diff -upr tcsh-6.18.00_orig/ed.chared.c tcsh-6.18.00_work/ed.chared.c +--- tcsh-6.18.00_orig/ed.chared.c 2013-03-28 10:26:00.801939093 +0100 ++++ tcsh-6.18.00_work/ed.chared.c 2013-03-28 10:30:37.000000000 +0100 +@@ -957,6 +957,7 @@ GetHistLine() + { + struct Hist *hp; + int h; ++ int history; + + if (Hist_num == 0) { /* if really the current line */ + if (HistBuf.s != NULL) +@@ -979,8 +980,10 @@ GetHistLine() + if (hp == NULL) + return(CC_ERROR); + ++ /* access only $history commands */ ++ history = getn(varval(STRhistory)); + for (h = 1; h < Hist_num; h++) { +- if ((hp->Hnext) == NULL) { ++ if ((hp->Hnext) == NULL || h >= history) { + Hist_num = h; + return(CC_ERROR); + } +diff -upr tcsh-6.18.00_orig/sh.hist.c tcsh-6.18.00_work/sh.hist.c +--- tcsh-6.18.00_orig/sh.hist.c 2013-03-28 10:26:00.794939068 +0100 ++++ tcsh-6.18.00_work/sh.hist.c 2013-03-28 10:25:19.000000000 +0100 +@@ -138,6 +138,7 @@ savehist( + int flg) + { + int histlen = 0; ++ int savehist = 0; + Char *cp; + + /* throw away null lines */ +@@ -151,6 +152,20 @@ savehist( + } + histlen = histlen * 10 + *cp++ - '0'; + } ++ ++ /* check savehist and history and use greater value to store all commands */ ++ cp = varval(STRsavehist); ++ while (*cp) { ++ if (!Isdigit(*cp)) { ++ savehist = 0; ++ break; ++ } ++ savehist = savehist * 10 + *cp++ - '0'; ++ } ++ ++ if (savehist > histlen) ++ histlen = savehist; ++ + if (sp) + (void) enthist(++eventno, sp, 1, flg, histlen); + discardExcess(histlen, flg); |