1 /* 2 * Trivial strnlen(3) implementation 3 */ 4 5 #include <stddef.h> 6 7 #include "strnlen.h" 8 9 size_t 10 strnlen(const char *s, size_t limit) 11 { 12 size_t len; 13 14 for (len = 0; len < limit; len++) 15 if (*s++ == '\0') 16 break; 17 18 return len; 19 } 20