summaryrefslogtreecommitdiff
path: root/sys/src/ape/lib/ap/gen/strchr.c
blob: b6d935f57454bbc05c8fa126681fae4f3c2b0b96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <string.h>

char*
strchr(const char *s, int c)
{
	char c1;

	if(c == 0) {
		while(*s++)
			;
		return s-1;
	}

	while(c1 = *s++)
		if(c1 == c)
			return s-1;
	return 0;
}