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
/
strlen.c
diff --git
a/lunaix-os/libs/libc/string/strlen.c
b/lunaix-os/libs/libc/string/strlen.c
index 8b26def28331dfc3460d6fc36a8ee89ab13b030d..b57ec902fde1ec7489f700c783294a1f3c1da830 100644
(file)
--- a/
lunaix-os/libs/libc/string/strlen.c
+++ b/
lunaix-os/libs/libc/string/strlen.c
@@
-7,4
+7,12
@@
strlen(const char* str)
while (str[len])
len++;
return len;
+}
+
+size_t
+strnlen(const char* str, size_t max_len) {
+ size_t len = 0;
+ while (str[len] && len <= max_len)
+ len++;
+ return len;
}
\ No newline at end of file