From 7a6d6d485be0e69dcee29e05887c40924e0d1947 Mon Sep 17 00:00:00 2001 From: Fish <> Date: Mon, 3 Mar 2008 08:13:24 +0000 Subject: [PATCH] more fixes for win32 --- configure | 2 ++ configure.in | 1 + include/config.h.in | 3 +++ lib/nxml/mrss_internal.h | 4 ++++ lib/nxml/nxml_internal.h | 2 ++ src/support.c | 46 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 58 insertions(+) diff --git a/configure b/configure index 9ad4f26e..9fff7231 100755 --- a/configure +++ b/configure @@ -13583,6 +13583,7 @@ rm -f conftest* + for ac_func in socket \ @@ -13590,6 +13591,7 @@ for ac_func in socket \ strdup \ strstr \ strspn \ + strsep \ strcasestr \ strtok_r \ uname \ diff --git a/configure.in b/configure.in index fa777177..f4dae121 100644 --- a/configure.in +++ b/configure.in @@ -160,6 +160,7 @@ AC_CHECK_FUNCS( socket \ strdup \ strstr \ strspn \ + strsep \ strcasestr \ strtok_r \ uname \ diff --git a/include/config.h.in b/include/config.h.in index 7bc7f895..f1a42027 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -449,6 +449,9 @@ /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR +/* Define to 1 if you have the `strsep' function. */ +#undef HAVE_STRSEP + /* Define to 1 if you have the `strtok_r' function. */ #undef HAVE_STRTOK_R diff --git a/lib/nxml/mrss_internal.h b/lib/nxml/mrss_internal.h index 3c645d9c..00a2f988 100644 --- a/lib/nxml/mrss_internal.h +++ b/lib/nxml/mrss_internal.h @@ -38,6 +38,10 @@ char * __mrss_download_file (nxml_t *, char *, size_t *, mrss_error_t *, CURLcode *code); +#ifdef WIN32 +#define lstat(path, sb) stat((path), (sb)) +#endif + #endif /* EOF */ diff --git a/lib/nxml/nxml_internal.h b/lib/nxml/nxml_internal.h index cd2849f0..cbe3f6e9 100644 --- a/lib/nxml/nxml_internal.h +++ b/lib/nxml/nxml_internal.h @@ -23,6 +23,8 @@ #ifdef WIN32 #define int64_t __int64 +#define strncasecmp strnicmp +#define strcasecmp stricmp #endif /* Rule [4] */ diff --git a/src/support.c b/src/support.c index c9fc748d..d4760378 100644 --- a/src/support.c +++ b/src/support.c @@ -268,3 +268,49 @@ int inet_aton( const char *name, struct in_addr *addr ) return ( addr->s_addr == INADDR_NONE ? 0 : 1 ); } #endif /* HAVE_INET_ATON */ +#ifndef HAVE_STRSEP +char * +strsep (char **stringp, const char *delim) +{ + char *begin, *end; + + begin = *stringp; + if (begin == NULL) + return NULL; + + /* A frequent case is when the delimiter string contains only one + character. Here we don't need to call the expensive `strpbrk' + function and instead work using `strchr'. */ + if (delim[0] == '\0' || delim[1] == '\0') + { + char ch = delim[0]; + + if (ch == '\0') + end = NULL; + else + { + if (*begin == ch) + end = begin; + else if (*begin == '\0') + end = NULL; + else + end = strchr (begin + 1, ch); + } + } + else + /* Find the end of the token. */ + end = strpbrk (begin, delim); + + if (end) + { + /* Terminate the token and set *STRINGP past NUL character. */ + *end++ = '\0'; + *stringp = end; + } + else + /* No more delimiters; this is the last token. */ + *stringp = NULL; + + return begin; +} +#endif \ No newline at end of file