mirror of
https://github.com/stefanocasazza/ULib.git
synced 2025-09-28 19:05:55 +08:00
20 lines
370 B
C
20 lines
370 B
C
/* Public domain. */
|
|
|
|
#include "str.h"
|
|
|
|
unsigned int str_chr(register const char *s,int c)
|
|
{
|
|
register char ch;
|
|
register const char *t;
|
|
|
|
ch = c;
|
|
t = s;
|
|
for (;;) {
|
|
if (!*t) break; if (*t == ch) break; ++t;
|
|
if (!*t) break; if (*t == ch) break; ++t;
|
|
if (!*t) break; if (*t == ch) break; ++t;
|
|
if (!*t) break; if (*t == ch) break; ++t;
|
|
}
|
|
return t - s;
|
|
}
|