1169695Skan/* Portable version of strrchr().
2169695Skan   This function is in the public domain. */
3169695Skan
4169695Skan/*
5169695Skan
6169695Skan@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c})
7169695Skan
8169695SkanReturns a pointer to the last occurrence of the character @var{c} in
9169695Skanthe string @var{s}, or @code{NULL} if not found.  If @var{c} is itself the
10169695Skannull character, the results are undefined.
11169695Skan
12169695Skan@end deftypefn
13169695Skan
14169695Skan*/
15169695Skan
16169695Skan#include <ansidecl.h>
17169695Skan
18169695Skanchar *
19169695Skanstrrchr (register const char *s, int c)
20169695Skan{
21169695Skan  char *rtnval = 0;
22169695Skan
23169695Skan  do {
24169695Skan    if (*s == c)
25169695Skan      rtnval = (char*) s;
26169695Skan  } while (*s++);
27169695Skan  return (rtnval);
28169695Skan}
29