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