summaryrefslogtreecommitdiff
path: root/src/init
diff options
context:
space:
mode:
Diffstat (limited to 'src/init')
-rw-r--r--src/init/stdlib.c11
-rw-r--r--src/init/stdlib.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/init/stdlib.c b/src/init/stdlib.c
index 4bc90d2..3714324 100644
--- a/src/init/stdlib.c
+++ b/src/init/stdlib.c
@@ -13,6 +13,17 @@ int memcmp(const void *s1, const void *s2, size_t n) {
return 0;
}
+int strcmp(const char *s1, const char *s2) {
+ while (*s1) {
+ if (*s1 != *s2) {
+ if (*s1 < *s2) return -1;
+ else return 1;
+ }
+ s1++; s2++;
+ }
+ return 0;
+}
+
size_t strlen(const char *s) {
size_t c = 0;
while (*s++) c++;
diff --git a/src/init/stdlib.h b/src/init/stdlib.h
index 3e56beb..a3a8b64 100644
--- a/src/init/stdlib.h
+++ b/src/init/stdlib.h
@@ -6,6 +6,7 @@
int memcmp(const void *s1, const void *s2, size_t n);
+int strcmp(const char *s1, const char *s2);
size_t strlen(const char *s);
int printf(const char *fmt, ...);