diff options
Diffstat (limited to 'pbl/string.c')
-rw-r--r-- | pbl/string.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pbl/string.c b/pbl/string.c index 927c92dc05..46bf0b32b3 100644 --- a/pbl/string.c +++ b/pbl/string.c @@ -133,3 +133,19 @@ size_t strnlen(const char * s, size_t count) /* nothing */; return sc - s; } + +/** + * strrchr - Find the last occurrence of a character in a string + * @s: The string to be searched + * @c: The character to search for + */ +char * _strrchr(const char * s, int c) +{ + const char *p = s + strlen(s); + + do { + if (*p == (char)c) + return (char *)p; + } while (--p >= s); + return NULL; +} |