144574Sphk/* Portable version of strrchr().
244574Sphk   This function is in the public domain. */
344574Sphk
444574Sphk/*
544574Sphk
644574Sphk@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c})
744574Sphk
844574SphkReturns a pointer to the last occurrence of the character @var{c} in
944574Sphkthe string @var{s}, or @code{NULL} if not found.  If @var{c} is itself the
1044574Sphknull character, the results are undefined.
1144574Sphk
1244574Sphk@end deftypefn
1344574Sphk
1444574Sphk*/
1544574Sphk
1644574Sphk#include <ansidecl.h>
1744574Sphk
182291Sjkhchar *
192291Sjkhstrrchr (register const char *s, int c)
202291Sjkh{
212291Sjkh  char *rtnval = 0;
2244574Sphk
2344574Sphk  do {
2444574Sphk    if (*s == c)
2521101Sjhay      rtnval = (char*) s;
2621101Sjhay  } while (*s++);
2721101Sjhay  return (rtnval);
282291Sjkh}
292291Sjkh