xref: /plan9/sys/src/cmd/unix/drawterm/libc/runestrchr.c (revision 8ccd4a6360d974db7bd7bbd4f37e7018419ea908)
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