summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/include/string.h4
-rw-r--r--src/lib/string.C11
2 files changed, 14 insertions, 1 deletions
diff --git a/src/include/string.h b/src/include/string.h
index aa7659349..1e1ce9113 100755
--- a/src/include/string.h
+++ b/src/include/string.h
@@ -26,7 +26,7 @@
#include <stdint.h>
#ifdef __cplusplus
-extern "C"
+extern "C"
{
#endif
void *memset(void* s, int c, size_t n);
@@ -39,6 +39,8 @@ extern "C"
int strcmp(const char* s1, const char* s2);
size_t strlen(const char* s1);
+ char* strchr(const char* s, int c);
+
#ifdef __cplusplus
};
#endif
diff --git a/src/lib/string.C b/src/lib/string.C
index 5eca78439..fdfa06280 100644
--- a/src/lib/string.C
+++ b/src/lib/string.C
@@ -164,3 +164,14 @@ extern "C" size_t strlen(const char* a)
}
return length;
}
+
+extern "C" char* strchr(const char* s, int c)
+{
+ while((*s != '\0') && (*s != c))
+ {
+ s++;
+ }
+
+ if (*s == c) return (char*)s;
+ return NULL;
+}
OpenPOWER on IntegriCloud