blob: b2178ba40e9db8167d6329521cef896462a8523d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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);
|