summaryrefslogtreecommitdiff
path: root/libc/string/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/string/string.c')
-rw-r--r--libc/string/string.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libc/string/string.c b/libc/string/string.c
index 94bf542e4..591f875f9 100644
--- a/libc/string/string.c
+++ b/libc/string/string.c
@@ -376,6 +376,22 @@ void *memchr(const void *str, int c, size_t len)
}
#endif
+/********************** Function memrchr ************************************/
+
+#ifdef L_memrchr
+void *memrchr(const void *str, int c, size_t len)
+{
+ register unsigned char *ptr;
+
+ for (ptr = (unsigned char *) str + len; len > 0; len--) {
+ if (*--ptr == (unsigned char) c)
+ return ptr;
+ }
+
+ return 0;
+}
+#endif
+
/********************** Function memcmp ************************************/
#ifdef L_memcmp