Commit 6ab65441 authored by rswindell's avatar rswindell
Browse files

Include a reimplementation of BSD strlcpy(), currently only enabled in Windows

builds.
parent c4e4cdef
......@@ -78,6 +78,23 @@ int DLLCALL safe_snprintf(char *dst, size_t size, const char *fmt, ...)
return(numchars);
}
#ifdef NEEDS_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t size)
{
size_t i;
if(size < 1)
return 0;
for(i = 0; src[i] != '\0'; i++) {
if(i < (size - 1))
*(dst++) = src[i];
}
*dst = 0;
return i;
}
#endif
#ifdef _WIN32
/****************************************************************************/
/* Case insensitive version of strstr() - currently heavy-handed */
......
......@@ -224,6 +224,7 @@ extern "C" {
#define snprintf _snprintf
#endif
#define vsnprintf _vsnprintf
#define NEEDS_STRLCPY
#endif
#if defined(__WATCOMC__)
......@@ -244,6 +245,10 @@ extern "C" {
#endif
#endif
#if defined(NEEDS_STRLCPY)
size_t strlcpy(char *dst, const char *src, size_t size);
#endif
#if defined(_WIN32)
DLLEXPORT char* DLLCALL strcasestr(const char* haystack, const char* needle);
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment