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*55872Sbostic static char sccsid[] = "@(#)rindex.c 5.10 (Berkeley) 08/07/92"; 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*55872Sbostic register const char *p; 22*55872Sbostic register int ch; 231978Swnj { 2434618Sbostic register char *save; 251978Swnj 2634618Sbostic for (save = NULL;; ++p) { 2734618Sbostic if (*p == ch) 2846613Sbostic save = (char *)p; 2934618Sbostic if (!*p) 3034618Sbostic return(save); 3134618Sbostic } 3234618Sbostic /* NOTREACHED */ 331978Swnj } 34