summaryrefslogtreecommitdiff
path: root/src/libc/string/string.c
diff options
context:
space:
mode:
authordzwdz2023-08-25 17:18:07 +0200
committerdzwdz2023-08-25 17:18:30 +0200
commiteff47b170a7b0ea24a7c6e3a538186faac758c23 (patch)
tree8d715835272aa4be0631d971c6608ba6885ad80c /src/libc/string/string.c
parenta767724386c9fe175c2fe4311511c0a402339c37 (diff)
bootstrap: support hardlinks in initrd
required for the binutils port
Diffstat (limited to 'src/libc/string/string.c')
-rw-r--r--src/libc/string/string.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libc/string/string.c b/src/libc/string/string.c
index ac1c757..014be4a 100644
--- a/src/libc/string/string.c
+++ b/src/libc/string/string.c
@@ -115,6 +115,15 @@ char *strdup(const char *s) {
return buf;
}
+size_t strnlen(const char *s, size_t len) {
+ for (size_t i = 0; i < len; i++) {
+ if (!s[i]) {
+ return i;
+ }
+ }
+ return len;
+}
+
/* strings.h */
int strcasecmp(const char *s1, const char *s2) {
return strncasecmp(s1, s2, ~0);