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*43489Sbostic static char sccsid[] = "@(#)rindex.c 5.8 (Berkeley) 06/23/90"; 1034618Sbostic #endif /* LIBC_SCCS and not lint */ 111978Swnj 1242148Sbostic #include <stddef.h> 1342181Sbostic #include <string.h> 1434618Sbostic 151978Swnj char * 16*43489Sbostic #ifdef STRRCHR 17*43489Sbostic strrchr(p, ch) 18*43489Sbostic #else 1934618Sbostic rindex(p, ch) 20*43489Sbostic #endif 2134618Sbostic register char *p, ch; 221978Swnj { 2334618Sbostic register char *save; 241978Swnj 2534618Sbostic for (save = NULL;; ++p) { 2634618Sbostic if (*p == ch) 2734618Sbostic save = p; 2834618Sbostic if (!*p) 2934618Sbostic return(save); 3034618Sbostic } 3134618Sbostic /* NOTREACHED */ 321978Swnj } 33