projects
/
mes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8991e92
)
mescc: Tinycc support: strrchr.
author
Jan Nieuwenhuizen
<janneke@gnu.org>
Sun, 30 Jul 2017 11:09:19 +0000
(13:09 +0200)
committer
Jan Nieuwenhuizen
<janneke@gnu.org>
Sun, 30 Jul 2017 11:09:19 +0000
(13:09 +0200)
* mlibc/libc-mes+tcc.c (strrchr): Implement.
mlibc/libc-mes+tcc.c
patch
|
blob
|
history
diff --git
a/mlibc/libc-mes+tcc.c
b/mlibc/libc-mes+tcc.c
index 1b917d2f0bc1532c08b446df068d45015a53a6bd..b704302c435fea16ddb3c0860838db149fbc8e93 100644
(file)
--- a/
mlibc/libc-mes+tcc.c
+++ b/
mlibc/libc-mes+tcc.c
@@
-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;
}