Complete (almost!) printf fmt support
[lunaix-os.git] / lunaix-os / libs / libc / string / strchr.c
diff --git a/lunaix-os/libs/libc/string/strchr.c b/lunaix-os/libs/libc/string/strchr.c
new file mode 100644 (file)
index 0000000..f122a7a
--- /dev/null
@@ -0,0 +1,14 @@
+#include <libc/string.h>
+
+const char*
+strchr(const char* str, int character)
+{
+    char c = (char)character;
+    while ((*str)) {
+        if (*str == c) {
+            return str;
+        }
+        str++;
+    }
+    return c == '\0' ? str : NULL;
+}
\ No newline at end of file