str_chr.c (378B)
1 /* Public domain. */ 2 3 #include "str.h" 4 5 unsigned int str_chr(register const char *s,int c) 6 { 7 register char ch; 8 register const char *t; 9 10 ch = c; 11 t = s; 12 for (;;) { 13 if (!*t) break; if (*t == ch) break; ++t; 14 if (!*t) break; if (*t == ch) break; ++t; 15 if (!*t) break; if (*t == ch) break; ++t; 16 if (!*t) break; if (*t == ch) break; ++t; 17 } 18 return t - s; 19 }