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