Automatic date update in version.in
[binutils-gdb.git] / libiberty / strrchr.c
blob5cf7c14d8b746ea64cd49d44d598d5c96731fed8
1 /* Portable version of strrchr().
2 This function is in the public domain. */
4 /*
6 @deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c})
8 Returns a pointer to the last occurrence of the character @var{c} in
9 the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
10 null character, the results are undefined.
12 @end deftypefn
16 #include <ansidecl.h>
18 char *
19 strrchr (register const char *s, int c)
21 char *rtnval = 0;
23 do {
24 if (*s == c)
25 rtnval = (char*) s;
26 } while (*s++);
27 return (rtnval);