From: Gary V. Vaughan Date: Mon, 10 Jan 2000 15:40:25 +0000 (+0000) Subject: * libltdl/ltdl.h (LTDL_DIRSEP_CHAR): Define to '/' or '\', X-Git-Tag: release-1-3d~230 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9cd1acc5b40eca7166d00e53a1a88db34334a194;p=thirdparty%2Flibtool.git * 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 --- diff --git a/ChangeLog b/ChangeLog index 20334c336..98be1759d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2000-01-10 Gary V. Vaughan + + * 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 + 1999-12-18 Alexandre Oliva * ltmain.in: Oops, `largarg' -> `lastarg'. diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index ee5fcb3ed..c823431cb 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -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; } diff --git a/libltdl/ltdl.h b/libltdl/ltdl.h index b67e0b821..5c416b18c 100644 --- a/libltdl/ltdl.h +++ b/libltdl/ltdl.h @@ -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