xref: /csrg-svn/lib/libc/string/strrchr.c (revision 24156)
1 #ifndef lint
2 static char sccsid[] = "@(#)strrchr.c	5.1 (berkeley) 85/08/04";
3 #endif not lint
4 
5 /*
6  * Return the ptr in sp at which the character c last
7  * appears; NULL if not found
8  *
9  * This routine is just "rindex" renamed.
10  */
11 
12 #define NULL 0
13 
14 char *
15 strrchr(sp, c)
16 register char *sp, c;
17 {
18 	register char *r;
19 
20 	r = NULL;
21 	do {
22 		if (*sp == c)
23 			r = sp;
24 	} while (*sp++);
25 	return(r);
26 }
27