11978Swnj /* 234618Sbostic * Copyright (c) 1988 Regents of the University of California. 334618Sbostic * All rights reserved. 434618Sbostic * 542635Sbostic * %sccs.include.redist.c% 622103Smckusick */ 71978Swnj 834618Sbostic #if defined(LIBC_SCCS) && !defined(lint) 9*46613Sbostic static char sccsid[] = "@(#)rindex.c 5.9 (Berkeley) 02/24/91"; 1034618Sbostic #endif /* LIBC_SCCS and not lint */ 111978Swnj 1242148Sbostic #include <stddef.h> 1342181Sbostic #include <string.h> 1434618Sbostic 151978Swnj char * 1643489Sbostic #ifdef STRRCHR 1743489Sbostic strrchr(p, ch) 1843489Sbostic #else 1934618Sbostic rindex(p, ch) 2043489Sbostic #endif 21*46613Sbostic register const char *p, ch; 221978Swnj { 2334618Sbostic register char *save; 241978Swnj 2534618Sbostic for (save = NULL;; ++p) { 2634618Sbostic if (*p == ch) 27*46613Sbostic save = (char *)p; 2834618Sbostic if (!*p) 2934618Sbostic return(save); 3034618Sbostic } 3134618Sbostic /* NOTREACHED */ 321978Swnj } 33