diff --git a/pbl/string.c b/pbl/string.c index b773f5c..927c92d 100644 --- a/pbl/string.c +++ b/pbl/string.c @@ -119,3 +119,17 @@ *xs++ = c; return s; } + +/** + * strnlen - Find the length of a length-limited string + * @s: The string to be sized + * @count: The maximum number of bytes to search + */ +size_t strnlen(const char * s, size_t count) +{ + const char *sc; + + for (sc = s; count-- && *sc != '\0'; ++sc) + /* nothing */; + return sc - s; +}