56 lines
1.5 KiB
Diff
56 lines
1.5 KiB
Diff
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);
|