mescc: Tinycc support: strrchr.
* mlibc/libc-mes+tcc.c (strrchr): Implement.
This commit is contained in:
parent
8991e927c3
commit
af8335dc7a
|
@ -289,7 +289,14 @@ strchr (char const *s, int c)
|
|||
char *
|
||||
strrchr (char const *s, int c)
|
||||
{
|
||||
eputs ("strrchr stub\n");
|
||||
int n = strlen (s);
|
||||
if (!n) return 0;
|
||||
char const *p = s + n - 1;
|
||||
while (*p || !c)
|
||||
{
|
||||
if (c == *p) return p;
|
||||
*p--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue