#include <ncbi.h>
#include <gishlib.h>

CharPtr _cdecl
str_rchr(s, c)
	register CharPtr	s;
	register int	c;
{
	register CharPtr	save;

	if (c != NULLB) {
		while (*s != c)
			if (*s++ == NULLB)
				return NULL;
		for (;;) {
			do
				save = s;
			while (*++s == c);
			do
				if (*s == NULLB)
					return save;
			while (*++s != c);
		}
	}

	/* Special-case when c is the NULLB string terminator */
	while (*s != NULLB)
		++s;
	return s;
}
