#include <e_os.h>
#include "o_str.h"
-#undef strncasecmp
-#undef strcasecmp
-
int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n)
{
-#if defined(OPENSSL_SYS_VMS)
+#if defined(OPENSSL_IMPLEMENTS_strncasecmp)
while (*str1 && *str2 && n)
{
int res = toupper(*str1) - toupper(*str2);
if (*str2)
return -1;
return 0;
-#elif defined(OPENSSL_SYS_WINDOWS)
- return _strnicmp(str1, str2, n);
#else
+ /* Recursion hazard warning! Whenever strncasecmp is #defined as
+ * OPENSSL_strncasecmp, OPENSSL_IMPLEMENTS_strncasecmp must be
+ * defined as well. */
return strncasecmp(str1, str2, n);
#endif
}
int OPENSSL_strcasecmp(const char *str1, const char *str2)
{
-#if defined(OPENSSL_SYS_VMS)
+#if defined(OPENSSL_IMPLEMENTS_strncasecmp)
return OPENSSL_strncasecmp(str1, str2, (size_t)-1);
-#elif defined(OPENSSL_SYS_WINDOWS)
- return _stricmp(str1, str2);
#else
return strcasecmp(str1, str2);
#endif
# include "o_str.h"
# define strcasecmp OPENSSL_strcasecmp
# define strncasecmp OPENSSL_strncasecmp
+# define OPENSSL_IMPLEMENTS_strncasecmp
#elif defined(OPENSSL_SYS_OS2) && defined(__EMX__)
# define strcasecmp stricmp
# define strncasecmp strnicmp