summaryrefslogtreecommitdiff
path: root/lib/libc/string/strchr.c
blob: 01b2589aa6958e6fc9893af807685c7f123fb94f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "stddef.h" // for NULL

#include <string.h> // for strchr

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;
}