11978Swnj /* 2*61193Sbostic * Copyright (c) 1988, 1993 3*61193Sbostic * The Regents of the University of California. All rights reserved. 434618Sbostic * 542635Sbostic * %sccs.include.redist.c% 622103Smckusick */ 71978Swnj 834618Sbostic #if defined(LIBC_SCCS) && !defined(lint) 9*61193Sbostic static char sccsid[] = "@(#)rindex.c 8.1 (Berkeley) 06/04/93"; 1034618Sbostic #endif /* LIBC_SCCS and not lint */ 111978Swnj 1242148Sbostic #include <stddef.h> 1342181Sbostic #include <string.h> 1434618Sbostic 151978Swnj char * 1643489Sbostic #ifdef STRRCHR strrchr(p,ch)1743489Sbosticstrrchr(p, ch) 1843489Sbostic #else 1934618Sbostic rindex(p, ch) 2043489Sbostic #endif 2155872Sbostic register const char *p; 2255872Sbostic 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