]> git.pld-linux.org Git - packages/lynx.git/commitdiff
- CONFIG_DIR support
authorjuandon <witekfl@pld-linux.org>
Mon, 10 Mar 2003 14:50:06 +0000 (14:50 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    lynx-home_etc.patch -> 1.1

lynx-home_etc.patch [new file with mode: 0644]

diff --git a/lynx-home_etc.patch b/lynx-home_etc.patch
new file mode 100644 (file)
index 0000000..349ffe3
--- /dev/null
@@ -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);
++      }
+ }
+ /*
This page took 0.048472 seconds and 4 git commands to generate.