From 93ce4f4248999adeb85c6859dc2b5c54d7a8d7b7 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 7 Aug 2022 00:04:54 +0200 Subject: user/libc: strchr --- src/user/lib/string.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/user/lib/string.c') diff --git a/src/user/lib/string.c b/src/user/lib/string.c index 77b996c..92b2e51 100644 --- a/src/user/lib/string.c +++ b/src/user/lib/string.c @@ -49,3 +49,11 @@ long strtol(const char *restrict s, char **restrict end, int base) { if (end) *end = (void*)s; return res * sign; } + +char *strchr(const char *s, int c) { + while (*s) { + if (*s == c) return s; + s++; + } + return NULL; +} -- cgit v1.2.3