SHA256
1
0
forked from pool/tcsh

(Re)add patch tcsh-6.24.10-history-merge.dif

OBS-URL: https://build.opensuse.org/package/show/shells/tcsh?expand=0&rev=154
This commit is contained in:
Dr. Werner Fink 2023-07-14 11:31:09 +00:00 committed by Git OBS Bridge
parent a5fc65e5e5
commit f606df7bb1
3 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,60 @@
---
sh.hist.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
--- sh.hist.c
+++ sh.hist.c 2023-07-13 09:18:13.149624778 +0000
@@ -105,7 +105,7 @@ hremove(struct Hist *hp)
/* Prune length of history list to specified size by history variable. */
PG_STATIC void
-discardExcess(int hlen)
+discardExcess(int hlen, int mflg)
{
struct Hist *hp, *np;
if (histTail == NULL) {
@@ -116,13 +116,13 @@ discardExcess(int hlen)
* the list is still too long scan the whole list as before. But only do a
* full scan if the list is more than 6% (1/16th) too long. */
while (histCount > (unsigned)hlen && (np = Histlist.Hnext)) {
- if (eventno - np->Href >= hlen || hlen == 0)
+ if ((eventno - np->Href >= hlen || hlen == 0) && !mflg)
hremove(np), hfree(np);
else
break;
}
while (histCount > (unsigned)hlen && (np = histTail) != &Histlist) {
- if (eventno - np->Href >= hlen || hlen == 0)
+ if (eventno - np->Href >= hlen || hlen == 0 || mflg)
hremove(np), hfree(np);
else
break;
@@ -148,7 +148,7 @@ savehist(
return;
if (sp)
(void) enthist(++eventno, sp, 1, mflg, histlen);
- discardExcess(histlen);
+ discardExcess(histlen, mflg);
}
#define USE_JENKINS_HASH 1
@@ -1404,6 +1404,18 @@ loadhist(Char *fname, int mflg)
void
sethistory(int n)
{
+ int mflg = 0;
+ struct varent *shist;
+
+ if ((shist = adrof(STRsavehist)) != NULL && shist->vec != NULL) {
+ size_t i;
+ for (i = 1; shist->vec[i]; i++) {
+ if (eq(shist->vec[i], STRmerge)) {
+ mflg++;
+ break;
+ }
+ }
+ }
histlen = n;
- discardExcess(histlen);
+ discardExcess(histlen, mflg);
}

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Jul 14 11:29:02 UTC 2023 - Dr. Werner Fink <werner@suse.de>
- (Re)add patch tcsh-6.24.10-history-merge.dif
* which is port of an old patch as the problem was not gone
* Make it possible to merge current history with already
written history
-------------------------------------------------------------------
Sat Apr 15 09:32:21 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -31,6 +31,7 @@ Source4: tcsh.keyring
Patch0: tcsh-6.21.00.dif
Patch1: tcsh-6.15.00-pipe.dif
Patch2: tcsh-6.16.00-norm-cmd.dif
Patch3: tcsh-6.24.10-history-merge.dif
Patch4: tcsh-6.18.03-colorls.dif
Patch5: tcsh-6.17.06-dspmbyte.dif
Patch6: tcsh-6.18.03-catalogs.dif
@ -57,6 +58,7 @@ correction, a history mechanism, job control, and a C-like syntax.
%setup -q
%patch1 -b .pipe
%patch2 -b .normcmd
%patch3 -b .merge
%patch4 -b .colorls
%patch5 -b .dspmbyte
%patch6 -b .catalogs