/*
 *			s t r r c h . c
 */

/*)LIBRARY
*/

#ifdef	DOCUMENTATION

title	strrchr	Find Last Instance of a Character in a String
index		Find last instance of a character in a string

synopsis
	.s.nf
	char *
	strrchr(stng, chr)
	char		*stng;	/* String to search in	*/
	char		chr;	/* Byte to search for	*/
	.s.f
Description

	If chr is in stng, return a pointer to the last (rightmost)
	occurrance of it.  If not, return NULL.

Bugs

#endif

#define	EOS	0
#define	NULL	0

char *
strrchr(stng, chr)
register char	*stng;
register char	chr;
/*
 * Return rightmost instance of chr in stng.
 */
{
	register char	*result;

	result = NULL;

	do {
	    if (*stng == chr)
		result = stng;
	} while (*stng++ != EOS);
	return (result);
}
