diff options
Diffstat (limited to 'system/less/search-path-lesskey-file.patch')
-rw-r--r-- | system/less/search-path-lesskey-file.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/system/less/search-path-lesskey-file.patch b/system/less/search-path-lesskey-file.patch new file mode 100644 index 000000000..422376930 --- /dev/null +++ b/system/less/search-path-lesskey-file.patch @@ -0,0 +1,37 @@ +From d3edebf528da8a9e15d6be518c24e90462a28698 Mon Sep 17 00:00:00 2001 +From: Mark Nudelman <markn@greenwoodsoftware.com> +Date: Tue, 19 Oct 2021 14:24:04 -0700 +Subject: [PATCH] Add $HOME/.config to possible locations of lesskey file. + +--- + NEWS | 4 ++++ + decode.c | 13 ++++++++++++- + less.nro.VER | 2 +- + 3 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/decode.c b/decode.c +index e1a55198..2eb480fa 100644 +--- a/decode.c ++++ b/decode.c +@@ -952,9 +952,20 @@ add_hometable(call_lesskey, envname, def_filename, sysvar) + filename = save(def_filename); + else /* def_filename is just basename */ + { ++ /* Remove first char (normally a dot) unless stored in $HOME. */ + char *xdg = lgetenv("XDG_CONFIG_HOME"); + if (!isnullenv(xdg)) +- filename = dirfile(xdg, def_filename+1, 1); ++ filename = dirfile(xdg, &def_filename[1], 1); ++ if (filename == NULL) ++ { ++ char *home = lgetenv("HOME"); ++ if (!isnullenv(home)) ++ { ++ char *cfg_dir = dirfile(home, ".config", 0); ++ filename = dirfile(cfg_dir, &def_filename[1], 1); ++ free(cfg_dir); ++ } ++ } + if (filename == NULL) + filename = homefile(def_filename); + } |