11978Swnj /* 234618Sbostic * Copyright (c) 1988 Regents of the University of California. 334618Sbostic * All rights reserved. 434618Sbostic * 534618Sbostic * Redistribution and use in source and binary forms are permitted 634821Sbostic * provided that the above copyright notice and this paragraph are 734821Sbostic * duplicated in all such forms and that any documentation, 834821Sbostic * advertising materials, and other materials related to such 934821Sbostic * distribution and use acknowledge that the software was developed 1034821Sbostic * by the University of California, Berkeley. The name of the 1134821Sbostic * University may not be used to endorse or promote products derived 1234821Sbostic * from this software without specific prior written permission. 1334821Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1434821Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 1534821Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1622103Smckusick */ 171978Swnj 1834618Sbostic #if defined(LIBC_SCCS) && !defined(lint) 19*42148Sbostic static char sccsid[] = "@(#)rindex.c 5.5 (Berkeley) 05/16/90"; 2034618Sbostic #endif /* LIBC_SCCS and not lint */ 211978Swnj 22*42148Sbostic #include <stddef.h> 2334618Sbostic 241978Swnj char * 2534618Sbostic rindex(p, ch) 2634618Sbostic register char *p, ch; 271978Swnj { 2834618Sbostic register char *save; 291978Swnj 3034618Sbostic for (save = NULL;; ++p) { 3134618Sbostic if (*p == ch) 3234618Sbostic save = p; 3334618Sbostic if (!*p) 3434618Sbostic return(save); 3534618Sbostic } 3634618Sbostic /* NOTREACHED */ 371978Swnj } 38