more fixes for win32

This commit is contained in:
Fish 2008-03-03 08:13:24 +00:00
parent b94929d9fd
commit 7a6d6d485b
6 changed files with 58 additions and 0 deletions

2
configure vendored
View file

@ -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 \

View file

@ -160,6 +160,7 @@ AC_CHECK_FUNCS( socket \
strdup \
strstr \
strspn \
strsep \
strcasestr \
strtok_r \
uname \

View file

@ -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

View file

@ -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 */

View file

@ -23,6 +23,8 @@
#ifdef WIN32
#define int64_t __int64
#define strncasecmp strnicmp
#define strcasecmp stricmp
#endif
/* Rule [4] */

View file

@ -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