diff options
author | dzwdz | 2021-10-06 06:32:29 +0000 |
---|---|---|
committer | dzwdz | 2021-10-06 06:32:29 +0000 |
commit | 381f9b26bd31072530d795c38c19ce3dd69954a6 (patch) | |
tree | 0146b779e386d115ea34b547be9f329e63f59ace /src/init/stdlib.c | |
parent | a3469d648a4d0f276d979ceb14b8716b46f4f72e (diff) |
init: implement strlen
Diffstat (limited to 'src/init/stdlib.c')
-rw-r--r-- | src/init/stdlib.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/init/stdlib.c b/src/init/stdlib.c index ac80c28..56d6da6 100644 --- a/src/init/stdlib.c +++ b/src/init/stdlib.c @@ -13,6 +13,12 @@ int memcmp(const void *s1, const void *s2, size_t n) { return 0; } +size_t strlen(const char *s) { + size_t c = 0; + while (*s++) c++; + return c; +} + int printf(const char *fmt, ...) { const char *seg = fmt; // beginning of the current segment int total = 0; |