runestrchr.c 207 B

1234567891011121314151617181920
  1. #include <u.h>
  2. #include <libc.h>
  3. Rune*
  4. runestrchr(Rune *s, Rune c)
  5. {
  6. Rune c0 = c;
  7. Rune c1;
  8. if(c == 0) {
  9. while(*s++)
  10. ;
  11. return s-1;
  12. }
  13. while(c1 = *s++)
  14. if(c1 == c0)
  15. return s-1;
  16. return 0;
  17. }