summaryrefslogtreecommitdiff
path: root/libkern/strchr.c
blob: 1d4d425cfd54e1f2bd7d14aa5a78c3d31c4f971f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <lib9.h>

char*
strchr(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;
}