k-tana-zero/libs/libc/strnlen.c
Julien CLEMENT 7178dbb6a7 feat: add given files
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
2021-07-12 15:57:08 +02:00

11 lines
147 B
C

#include <string.h>
size_t strnlen(const char *s, size_t maxlen)
{
size_t i = 0;
for (; i < maxlen; ++i)
if (!s[i])
return i;
return i;
}