diff options
Diffstat (limited to 'userland/libc/string/strchr.c')
-rw-r--r-- | userland/libc/string/strchr.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/userland/libc/string/strchr.c b/userland/libc/string/strchr.c new file mode 100644 index 0000000..1995547 --- /dev/null +++ b/userland/libc/string/strchr.c @@ -0,0 +1,11 @@ +#include <string.h> + +char *strchr(const char *s, int c) { + for (; *s; s++) { + if (*s == (char)c) + return (char*)s; + } + if ((char)c == '\0') + return (char *)s; + return NULL; +} |