summaryrefslogtreecommitdiff
path: root/lib/libc/string/strchr.c
blob: 06fb51bca8675429fc2e271c828c77e944dcc7a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <string.h> // for strchr, NULL

char *strchr(const char *s, int c)
{
	while (*s) {
		if (*s == (char)c)
			return (char *)s;
		s++;
	}
	if (c == 0)
		return (char *)s;
	return NULL;
}