]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/ltdl.h (LTDL_DIRSEP_CHAR): Define to '/' or '\',
authorGary V. Vaughan <gary@gnu.org>
Mon, 10 Jan 2000 15:40:25 +0000 (15:40 +0000)
committerGary V. Vaughan <gary@gnu.org>
Mon, 10 Jan 2000 15:40:25 +0000 (15:40 +0000)
as suitable for the target host.
(LTDL_PATHSEP_CHAR): Similarly with ':' or ';'.
* libltdl/ltdl.c: Use LTDL_DIRSEP_CHAR and LTDL_PATHSEP_CHAR
instead of hardcoding throughout.
Reported by Jon Leichter <jon@symas.com>

ChangeLog
libltdl/ltdl.c
libltdl/ltdl.h

index 20334c33656ded80e17ab2beb2cc031a5481c2e3..98be1759d385c079eb08eb72a8ff93680b61fc5b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2000-01-10  Gary V. Vaughan  <gary@oranda.demon.co.uk>
+
+       * libltdl/ltdl.h (LTDL_DIRSEP_CHAR): Define to '/' or '\\',
+       as suitable for the target host.
+       (LTDL_PATHSEP_CHAR): Similarly with ':' or ';'.
+       * libltdl/ltdl.c: Use LTDL_DIRSEP_CHAR and LTDL_PATHSEP_CHAR
+       instead of hardcoding throughout.
+       Reported by Jon Leichter <jon@symas.com>
+
 1999-12-18  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
 
        * ltmain.in: Oops, `largarg' -> `lastarg'.
index ee5fcb3ed48dd6d0f3a94fbb1b7da7862057b893..c823431cb558b4a2bc8f50c4ec54e249fe50c0d1 100644 (file)
@@ -986,9 +986,8 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
                                last_error = memory_error;
                                return 1;
                        }
-                       strcpy(filename, libdir);
-                       strcat(filename, "/");
-                       strcat(filename, dlname);
+                       sprintf (filename, "%s%c%s", libdir, LTDL_DIRSEP_CHAR,
+                                dlname);
                        error = tryall_dlopen(handle, filename) == 0;
                        lt_dlfree(filename);
                        if (error)
@@ -1058,11 +1057,11 @@ find_file (basename, search_path, pdir, handle)
                int lendir;
                const char *cur = next;
 
-               next = strchr(cur, ':');
+               next = strchr(cur, LTDL_PATHSEP_CHAR);
                if (!next)
                        next = cur + strlen(cur);
                lendir = next - cur;
-               if (*next == ':')
+               if (*next == LTDL_PATHSEP_CHAR)
                        ++next;
                else
                        next = 0;
@@ -1079,8 +1078,8 @@ find_file (basename, search_path, pdir, handle)
                        }
                }
                strncpy(filename, cur, lendir);
-               if (filename[lendir-1] != '/')
-                       filename[lendir++] = '/';
+               if (filename[lendir-1] != LTDL_DIRSEP_CHAR)
+                       filename[lendir++] = LTDL_DIRSEP_CHAR;
                strcpy(filename+lendir, basename);
                if (handle) {
                        if (tryall_dlopen(handle, filename) == 0) {
@@ -1210,7 +1209,7 @@ lt_dlopen (filename)
                }
                goto register_handle;
        }
-       basename = strrchr(filename, '/');
+       basename = strrchr(filename, LTDL_DIRSEP_CHAR);
        if (basename) {
                basename++;
                dir = (char*) lt_dlmalloc(basename - filename + 1);
@@ -1596,9 +1595,8 @@ lt_dladdsearchdir (search_dir)
                        last_error = memory_error;
                        return 1;
                }
-               strcpy(new_search_path, user_search_path);
-               strcat(new_search_path, ":");
-               strcat(new_search_path, search_dir);
+               sprintf (new_search_path, "%s%c%s", user_search_path,
+                        LTDL_PATHSEP_CHAR, search_dir);
                lt_dlfree(user_search_path);
                user_search_path = new_search_path;
        }
index b67e0b8212dd64501915c5bebf63d6931a022e07..5c416b18c7809c3024c780ae531b9c718b38ff4f 100644 (file)
@@ -28,6 +28,18 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 #ifndef _LTDL_H_
 #define _LTDL_H_ 1
 
+/* Canonicalise Windows and Cygwin recognition macros.  */
+#ifdef __CYGWIN32__
+#  ifndef __CYGWIN__
+#    define __CYGWIN__ __CYGWIN32__
+#  endif
+#endif
+#ifdef _WIN32
+#  ifndef WIN32
+#    define WIN32 _WIN32
+#  endif
+#endif
+
 /* __BEGIN_DECLS should be used at the beginning of your declarations,
    so that C++ compilers don't mangle their names.  Use __END_DECLS at
    the end of C declarations. */
@@ -54,6 +66,17 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 # define lt_ptr_t      char*
 #endif
 
+#ifdef WIN32
+#  ifndef __CYGWIN__
+#    define LTDL_DIRSEP_CHAR   '\\'
+#    define LTDL_PATHSEP_CHAR  ';'
+#  endif
+#endif
+#ifndef LTDL_DIRSEP_CHAR
+#  define LTDL_DIRSEP_CHAR     '/'
+#  define LTDL_PATHSEP_CHAR    ':'
+#endif
+
 /* DLL building support on win32 hosts;  mostly to workaround their
    ridiculous implementation of data symbol exporting. */
 #ifndef LTDL_SCOPE