summaryrefslogtreecommitdiffstats
path: root/usr/klibc/strchr.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/strchr.c')
-rw-r--r--usr/klibc/strchr.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/usr/klibc/strchr.c b/usr/klibc/strchr.c
new file mode 100644
index 0000000..6040cc4
--- /dev/null
+++ b/usr/klibc/strchr.c
@@ -0,0 +1,19 @@
+/*
+ * strchr.c
+ */
+
+#include <string.h>
+#include <klibc/compiler.h>
+
+char *strchr(const char *s, int c)
+{
+ while (*s != (char)c) {
+ if (!*s)
+ return NULL;
+ s++;
+ }
+
+ return (char *)s;
+}
+
+__ALIAS(char *, index, (const char *, int), strchr)