Add strrchr implementation

This commit is contained in:
EnderIce2 2024-06-03 03:54:37 +03:00
parent 9eec276c18
commit 2489fd93f1
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD

View File

@ -477,6 +477,23 @@ EXTERNC char *strtok(char *src, const char *delim)
return NULL; return NULL;
} }
char *strrchr(const char *str, int c)
{
const char *last_occurrence = NULL;
while (*str)
{
if (*str == (char)c)
last_occurrence = str;
str++;
}
if (c == '\0')
return (char *)str;
return (char *)last_occurrence;
}
int strcasecmp(const char *s1, const char *s2) int strcasecmp(const char *s1, const char *s2)
{ {
const unsigned char *p1 = (const unsigned char *)s1; const unsigned char *p1 = (const unsigned char *)s1;