From e7f9d1acf4402d67763695a94751b6853fe5a608 Mon Sep 17 00:00:00 2001 From: juandon Date: Mon, 10 Mar 2003 14:50:06 +0000 Subject: [PATCH] - CONFIG_DIR support Changed files: lynx-home_etc.patch -> 1.1 --- lynx-home_etc.patch | 63 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 lynx-home_etc.patch diff --git a/lynx-home_etc.patch b/lynx-home_etc.patch new file mode 100644 index 0000000..349ffe3 --- /dev/null +++ b/lynx-home_etc.patch @@ -0,0 +1,63 @@ +diff -Nru lynx2-8-5/src/LYUtils.c lynx2-8-5.new/src/LYUtils.c +--- lynx2-8-5/src/LYUtils.c Thu Dec 19 01:57:10 2002 ++++ lynx2-8-5.new/src/LYUtils.c Mon Mar 10 14:32:58 2003 +@@ -5126,7 +5126,9 @@ + char *, fname) + { + char *home = NULL; ++ char *config_dir = getenv("CONFIG_DIR"); + char *file = fname; ++ char *file2 = NULL; + int len; + + /* +@@ -5149,13 +5151,39 @@ + /* + * Set up home string and length. - FM + */ +- StrAllocCopy(home, Home_Dir()); +- + #ifdef VMS + #define NO_HOMEPATH "Error:" + #else + #define NO_HOMEPATH "/error" + #endif /* VMS */ ++ ++ if (config_dir) { ++ StrAllocCopy(home, config_dir); ++ if (!non_empty(config_dir)) ++ /* ++ * Home_Dir() has a bug if this ever happens. - FM ++ */ ++ StrAllocCopy(config_dir, NO_HOMEPATH); ++ ++ len = fbuffer_size - (strlen(config_dir) + 1); ++ if (len <= 0) { ++ /* ++ * Buffer is smaller than or only big enough for the home path. ++ * Load what fits of the home path and return. This will fail, ++ * but we need something in the buffer. - FM ++ */ ++ LYstrncpy(fbuffer, config_dir, (fbuffer_size - 1)); ++ return; ++ } ++ /* ++ * Check whether we have a subdirectory path or just a filename. - FM ++ */ ++ file2 = (strncmp(file, "./", 2) ? file : file + 2); ++ sprintf(fbuffer, "%s/%.*s", config_dir, len, ++ (strncmp(file2, ".", 1) ? file2 : (file2+1))); ++ } else { ++ StrAllocCopy(home, Home_Dir()); ++ + if (!non_empty(home)) + /* + * Home_Dir() has a bug if this ever happens. - FM +@@ -5213,6 +5241,7 @@ + (strncmp(file, "./", 2) ? file : (file + 2))); + #endif /* VMS */ + FREE(home); ++ } + } + + /* -- 2.44.0