+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'.
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)
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;
}
}
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) {
}
goto register_handle;
}
- basename = strrchr(filename, '/');
+ basename = strrchr(filename, LTDL_DIRSEP_CHAR);
if (basename) {
basename++;
dir = (char*) lt_dlmalloc(basename - filename + 1);
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;
}
#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. */
# 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