xref: /haiku/src/system/libroot/posix/string/strrchr.c (revision 6288f7b4537703bfaa43bf8f8fa0c58e4c8dd82b)
1 /*
2  * Copyright 2001, Manuel J. Petit. All rights reserved.
3  * Distributed under the terms of the NewOS License.
4  */
5 
6 
7 #include <string.h>
8 #include <strings.h>
9 #include <sys/types.h>
10 
11 
12 char *
13 strrchr(char const *s, int c)
14 {
15 	char const *last = NULL;
16 
17 	for (;; s++) {
18 		if (*s == (char)c)
19 			last = s;
20 		if (*s == '\0')
21 			break;
22 	}
23 
24 	return (char *)last;
25 }
26 
27 
28 char *
29 rindex(char const *s, int c)
30 {
31 	return strrchr(s, c);
32 }
33 
34