git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
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
+++ b/
lunaix-os/libs/libc/string/strchr.c
@@ -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