vfs: check userland buffers before reading them.
[haiku.git] / src / system / libroot / posix / string / strrchr.c
blob0bb3195170187fd79753525170de980a28d7c7e5
1 /*
2 * Copyright 2001, Manuel J. Petit. All rights reserved.
3 * Distributed under the terms of the NewOS License.
4 */
7 #include <string.h>
8 #include <strings.h>
9 #include <sys/types.h>
12 char *
13 strrchr(char const *s, int c)
15 char const *last = NULL;
17 for (;; s++) {
18 if (*s == (char)c)
19 last = s;
20 if (*s == '\0')
21 break;
24 return (char *)last;
28 char *
29 rindex(char const *s, int c)
31 return strrchr(s, c);