]> git.ipfire.org Git - thirdparty/gcc.git/blame - libiberty/strrchr.c
* doc/extend.texi (Common Function Attributes): Clarify
[thirdparty/gcc.git] / libiberty / strrchr.c
CommitLineData
28e9041c 1/* Portable version of strrchr().
2 This function is in the public domain. */
3
4/*
614a23c6 5
6@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c})
7
997fdf4a 8Returns a pointer to the last occurrence of the character @var{c} in
a3a8a3df 9the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
614a23c6 10null character, the results are undefined.
11
12@end deftypefn
13
28e9041c 14*/
15
16#include <ansidecl.h>
17
18char *
cd72df1f 19strrchr (register const char *s, int c)
28e9041c 20{
21 char *rtnval = 0;
22
23 do {
24 if (*s == c)
25 rtnval = (char*) s;
26 } while (*s++);
27 return (rtnval);
28}