diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2018-01-25 08:49:33 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2018-01-25 08:49:33 +0000 |
commit | 8bbc33baa40010c8f5ca1af9b8bfffd67ae654ad (patch) | |
tree | c5e2748190eff9453ae08b9117c4c546c48cc539 /libiberty/strrchr.c | |
parent | 03ac50856c9fc8c96b7a17239ee40a10397750a7 (diff) | |
download | gcc-tarball-8bbc33baa40010c8f5ca1af9b8bfffd67ae654ad.tar.gz |
Diffstat (limited to 'libiberty/strrchr.c')
-rw-r--r-- | libiberty/strrchr.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libiberty/strrchr.c b/libiberty/strrchr.c new file mode 100644 index 0000000000..5cf7c14d8b --- /dev/null +++ b/libiberty/strrchr.c @@ -0,0 +1,28 @@ +/* Portable version of strrchr(). + This function is in the public domain. */ + +/* + +@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c}) + +Returns a pointer to the last occurrence of the character @var{c} in +the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the +null character, the results are undefined. + +@end deftypefn + +*/ + +#include <ansidecl.h> + +char * +strrchr (register const char *s, int c) +{ + char *rtnval = 0; + + do { + if (*s == c) + rtnval = (char*) s; + } while (*s++); + return (rtnval); +} |