xref: /csrg-svn/lib/libc/string/rindex.c (revision 42635)
11978Swnj /*
234618Sbostic  * Copyright (c) 1988 Regents of the University of California.
334618Sbostic  * All rights reserved.
434618Sbostic  *
5*42635Sbostic  * %sccs.include.redist.c%
622103Smckusick  */
71978Swnj 
834618Sbostic #if defined(LIBC_SCCS) && !defined(lint)
9*42635Sbostic static char sccsid[] = "@(#)rindex.c	5.7 (Berkeley) 06/01/90";
1034618Sbostic #endif /* LIBC_SCCS and not lint */
111978Swnj 
1242148Sbostic #include <stddef.h>
1342181Sbostic #include <string.h>
1434618Sbostic 
151978Swnj char *
1634618Sbostic rindex(p, ch)
1734618Sbostic 	register char *p, ch;
181978Swnj {
1934618Sbostic 	register char *save;
201978Swnj 
2134618Sbostic 	for (save = NULL;; ++p) {
2234618Sbostic 		if (*p == ch)
2334618Sbostic 			save = p;
2434618Sbostic 		if (!*p)
2534618Sbostic 			return(save);
2634618Sbostic 	}
2734618Sbostic 	/* NOTREACHED */
281978Swnj }
29