From eff47b170a7b0ea24a7c6e3a538186faac758c23 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 25 Aug 2023 17:18:07 +0200 Subject: bootstrap: support hardlinks in initrd required for the binutils port --- src/libc/string/string.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/libc/string/string.c') 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); -- cgit v1.2.3