summaryrefslogtreecommitdiff
path: root/com32/lib/strnlen.c
blob: c22f8dce5dd150f26b80ee11d7df27dfab6eb774 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * strnlen()
 */

#include <string.h>

size_t strnlen(const char *s, size_t n)
{
    const char *ss = s;
    while (n-- && *ss)
	ss++;
    return ss - s;
}