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