diff --git a/libmaxsi/include/strings.h b/libmaxsi/include/strings.h
new file mode 100644
index 00000000..0224d576
--- /dev/null
+++ b/libmaxsi/include/strings.h
@@ -0,0 +1,40 @@
+/******************************************************************************
+
+ COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011.
+
+ This file is part of LibMaxsi.
+
+ LibMaxsi is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
+ more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with LibMaxsi. If not, see .
+
+ strings.h
+ String operations.
+
+******************************************************************************/
+
+#ifndef _STRINGS_H
+#define _STRINGS_H 1
+
+#include
+
+__BEGIN_DECLS
+
+@include(size_t.h)
+@include(locale_t.h)
+
+int strcasecmp(const char* a, const char* b);
+int strncasecmp(const char* a, const char* b, size_t n);
+
+__END_DECLS
+
+#endif
diff --git a/libmaxsi/string.cpp b/libmaxsi/string.cpp
index f7a47098..6cd12f9b 100644
--- a/libmaxsi/string.cpp
+++ b/libmaxsi/string.cpp
@@ -27,6 +27,7 @@
#include
#include
#include
+#include
namespace Maxsi
{
@@ -121,6 +122,38 @@ namespace Maxsi
return 0;
}
+#ifndef SORTIX_KERNEL
+ inline int charcasecmp(char a, char b)
+ {
+ return tolower(a) == tolower(b);
+ }
+
+ extern "C" int strcasecmp(const char* a, const char* b)
+ {
+ while ( true )
+ {
+ char achar = *a++;
+ char bchar = *b++;
+ if ( !achar && !bchar ) { return 0; }
+ int cmp = charcasecmp(achar, bchar);
+ if ( cmp ) { return cmp; }
+ }
+ }
+
+ extern "C" int strncasecmp(const char* a, const char* b, size_t n)
+ {
+ while ( n-- )
+ {
+ char achar = *a++;
+ char bchar = *b++;
+ if ( !achar && !bchar ) { return 0; }
+ int cmp = charcasecmp(achar, bchar);
+ if ( cmp ) { return cmp; }
+ }
+ return 0;
+ }
+#endif
+
DUAL_FUNCTION(size_t, strspn, Accept, (const char* str, const char* accept))
{
size_t acceptlen = 0;