summaryrefslogtreecommitdiff
path: root/libc/string/string.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-12-19 12:46:31 +0000
committerEric Andersen <andersen@codepoet.org>2001-12-19 12:46:31 +0000
commit336f26dbe1cfffd17b465084bd87d027922467da (patch)
treecd8fdc5722fe099a0ac7e596221595062489a162 /libc/string/string.c
parentbf126cb24e809f36067ce43f9186cbe53b906cad (diff)
Add basename and dirname. Write memrchr.
-Erik
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