xref: /inferno-os/libkern/strchr.c (revision 7ef44d652ae9e5e1f5b3465d73684e4a54de73c0)
1 #include <lib9.h>
2 
3 char*
4 strchr(char *s, int c)
5 {
6 	char c1;
7 
8 	if(c == 0) {
9 		while(*s++)
10 			;
11 		return s-1;
12 	}
13 
14 	while(c1 = *s++)
15 		if(c1 == c)
16 			return s-1;
17 	return 0;
18 }
19