summaryrefslogtreecommitdiff
path: root/lib/libc/string/strlen.c
blob: a1a73b69f12b30f3ce7edaad407c9d6243a8a284 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <string.h>

size_t 
strlen(const char *s)
{
	int n;
	for (n = 0; s[n]; n++) 
		;
	return n;
}

size_t
strnlen(const char *s, size_t max)
{
	int n;
	for (n = 0; s[n] && n < max; n++)
		;
	return n;
}