xref: /plan9/sys/src/libc/port/strchr.c (revision 219b2ee8daee37f4aad58d63f21287faa8e4ffdc)
1 #include <u.h>
2 #include <libc.h>
3 
4 char*
5 strchr(char *s, char c)
6 {
7 	char c1;
8 
9 	if(c == 0) {
10 		while(*s++)
11 			;
12 		return s-1;
13 	}
14 
15 	while(c1 = *s++)
16 		if(c1 == c)
17 			return s-1;
18 	return 0;
19 }
20