summaryrefslogtreecommitdiff
path: root/userland/libc/string
diff options
context:
space:
mode:
Diffstat (limited to 'userland/libc/string')
-rw-r--r--userland/libc/string/strcasecmp.c1
-rw-r--r--userland/libc/string/strncasecmp.c1
-rw-r--r--userland/libc/string/strndup.c1
-rw-r--r--userland/libc/string/strpbrk.c2
-rw-r--r--userland/libc/string/strstr.c4
5 files changed, 6 insertions, 3 deletions
diff --git a/userland/libc/string/strcasecmp.c b/userland/libc/string/strcasecmp.c
index eed337b..6420dbf 100644
--- a/userland/libc/string/strcasecmp.c
+++ b/userland/libc/string/strcasecmp.c
@@ -1,3 +1,4 @@
+#include <ctype.h>
#include <strings.h>
int strcasecmp(const char *s1, const char *s2) {
diff --git a/userland/libc/string/strncasecmp.c b/userland/libc/string/strncasecmp.c
index 9ce8c04..c635a03 100644
--- a/userland/libc/string/strncasecmp.c
+++ b/userland/libc/string/strncasecmp.c
@@ -1,4 +1,5 @@
#include <strings.h>
+#include <ctype.h>
#include <stddef.h>
int strncasecmp(const char *s1, const char *s2, size_t n) {
diff --git a/userland/libc/string/strndup.c b/userland/libc/string/strndup.c
index ffb2088..22d6303 100644
--- a/userland/libc/string/strndup.c
+++ b/userland/libc/string/strndup.c
@@ -1,6 +1,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
+#include <math.h>
// The strndup() function shall be equivalent to the strdup() function,
// duplicating the provided s in a new block of memory allocated as if
diff --git a/userland/libc/string/strpbrk.c b/userland/libc/string/strpbrk.c
index fb16b0c..3bb058b 100644
--- a/userland/libc/string/strpbrk.c
+++ b/userland/libc/string/strpbrk.c
@@ -4,7 +4,7 @@ char *strpbrk(const char *s1, const char *s2) {
for (; *s1; s1++) {
for (const char *t = s2; *t; t++) {
if (*s1 == *t) {
- return s1;
+ return (char*)s1;
}
}
}
diff --git a/userland/libc/string/strstr.c b/userland/libc/string/strstr.c
index 20b9dc2..9de0954 100644
--- a/userland/libc/string/strstr.c
+++ b/userland/libc/string/strstr.c
@@ -3,7 +3,7 @@
char *strstr(const char *s1, const char *s2) {
// If s2 points to a string with zero length, the function shall return s1.
if ('\0' == *s2)
- return s1;
+ return (char*)s1;
for (; *s1; s1++) {
const char *t1 = s1;
const char *t2 = s2;
@@ -15,7 +15,7 @@ char *strstr(const char *s1, const char *s2) {
}
}
if (!is_dif)
- return s1;
+ return (char*)s1;
}
return NULL;
}