From fc8a56ec08e755e74c3eeb9b91885dd1d0560f37 Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Wed, 4 May 2022 02:50:34 +0000 Subject: system/less: bump { 581 --> 590 }. Note that the patches correspond to: * https://github.com/gwsw/less/commit/5e1f4ce2c3a2c0fd6a953c4f7ca2839370f9c3ae.patch * https://github.com/gwsw/less/commit/d3edebf528da8a9e15d6be518c24e90462a28698.patch with minor modifications to remove conflicts in non-code NRO and NEWS files. --- system/less/search-path-history-file.patch | 88 ++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 system/less/search-path-history-file.patch (limited to 'system/less/search-path-history-file.patch') diff --git a/system/less/search-path-history-file.patch b/system/less/search-path-history-file.patch new file mode 100644 index 000000000..7ec0ce9f1 --- /dev/null +++ b/system/less/search-path-history-file.patch @@ -0,0 +1,88 @@ +From 5e1f4ce2c3a2c0fd6a953c4f7ca2839370f9c3ae Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Fri, 3 Dec 2021 09:38:22 -0800 +Subject: [PATCH] Add $XDG_STATE_HOME and $HOME/.local/state to list of + directories to search for the history file. + +--- + cmdbuf.c | 48 ++++++++++++++++++++++++++++++++---------------- + less.nro.VER | 6 +++--- + 2 files changed, 35 insertions(+), 19 deletions(-) + +diff --git a/cmdbuf.c b/cmdbuf.c +index cd99010d..abbda9b9 100644 +--- a/cmdbuf.c ++++ b/cmdbuf.c +@@ -1401,14 +1401,41 @@ mlist_size(ml) + /* + * Get the name of the history file. + */ ++ static char * ++histfile_find(must_exist) ++ int must_exist; ++{ ++ char *home = lgetenv("HOME"); ++ char *name = NULL; ++ ++ /* Try in $XDG_DATA_STATE, then in $HOME/.local/state, then in $XDG_DATA_HOME, then in $HOME. */ ++#if OS2 ++ if (isnullenv(home)) ++ home = lgetenv("INIT"); ++#endif ++ name = dirfile(lgetenv("XDG_STATE_HOME"), &LESSHISTFILE[1], must_exist); ++ if (name == NULL) ++ { ++ char *dir = dirfile(home, ".local/state", 1); ++ if (dir != NULL) ++ { ++ name = dirfile(dir, &LESSHISTFILE[1], must_exist); ++ free(dir); ++ } ++ } ++ if (name == NULL) ++ name = dirfile(lgetenv("XDG_DATA_HOME"), &LESSHISTFILE[1], must_exist); ++ if (name == NULL) ++ name = dirfile(home, LESSHISTFILE, must_exist); ++ return (name); ++} ++ + static char * + histfile_name(must_exist) + int must_exist; + { +- char *home; +- char *xdg; + char *name; +- ++ + /* See if filename is explicitly specified by $LESSHISTFILE. */ + name = lgetenv("LESSHISTFILE"); + if (!isnullenv(name)) +@@ -1423,25 +1450,14 @@ histfile_name(must_exist) + if (strcmp(LESSHISTFILE, "") == 0 || strcmp(LESSHISTFILE, "-") == 0) + return (NULL); + +- /* Try in $XDG_DATA_HOME first, then in $HOME. */ +- xdg = lgetenv("XDG_DATA_HOME"); +- home = lgetenv("HOME"); +-#if OS2 +- if (isnullenv(home)) +- home = lgetenv("INIT"); +-#endif + name = NULL; + if (!must_exist) + { + /* If we're writing the file and the file already exists, use it. */ +- name = dirfile(xdg, &LESSHISTFILE[1], 1); +- if (name == NULL) +- name = dirfile(home, LESSHISTFILE, 1); ++ name = histfile_find(1); + } + if (name == NULL) +- name = dirfile(xdg, &LESSHISTFILE[1], must_exist); +- if (name == NULL) +- name = dirfile(home, LESSHISTFILE, must_exist); ++ name = histfile_find(must_exist); + return (name); + } + -- cgit v1.2.3-70-g09d2