diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-12-19 12:46:31 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-12-19 12:46:31 +0000 |
commit | 336f26dbe1cfffd17b465084bd87d027922467da (patch) | |
tree | cd8fdc5722fe099a0ac7e596221595062489a162 /libc/string/string.c | |
parent | bf126cb24e809f36067ce43f9186cbe53b906cad (diff) |
Add basename and dirname. Write memrchr.
-Erik
Diffstat (limited to 'libc/string/string.c')
-rw-r--r-- | libc/string/string.c | 16 |
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 |