ref: 58b406cf181a732417b57119b9da46836a2b3ada dir: /lib/c/strnlen.c/
#include <string.h> #undef strnlen size_t strnlen(const char *s, size_t maxlen) { size_t n; for (n = 0; n < maxlen && *s++; ++n) ; return n; }