|
Last change
on this file since 108 was 10, checked in by bird, 23 years ago |
|
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
|
File size:
603 bytes
|
| Line | |
|---|
| 1 | /* Portable version of strrchr().
|
|---|
| 2 | This function is in the public domain. */
|
|---|
| 3 |
|
|---|
| 4 | /*
|
|---|
| 5 | NAME
|
|---|
| 6 | strrchr -- return pointer to last occurance of a character
|
|---|
| 7 |
|
|---|
| 8 | SYNOPSIS
|
|---|
| 9 | char *strrchr (const char *s, int c)
|
|---|
| 10 |
|
|---|
| 11 | DESCRIPTION
|
|---|
| 12 | Returns a pointer to the last occurance of character C in
|
|---|
| 13 | string S, or a NULL pointer if no occurance is found.
|
|---|
| 14 |
|
|---|
| 15 | BUGS
|
|---|
| 16 | Behavior when character is the null character is implementation
|
|---|
| 17 | dependent.
|
|---|
| 18 | */
|
|---|
| 19 |
|
|---|
| 20 | #include <ansidecl.h>
|
|---|
| 21 |
|
|---|
| 22 | char *
|
|---|
| 23 | strrchr (s, c)
|
|---|
| 24 | register const char *s;
|
|---|
| 25 | int c;
|
|---|
| 26 | {
|
|---|
| 27 | char *rtnval = 0;
|
|---|
| 28 |
|
|---|
| 29 | do {
|
|---|
| 30 | if (*s == c)
|
|---|
| 31 | rtnval = (char*) s;
|
|---|
| 32 | } while (*s++);
|
|---|
| 33 | return (rtnval);
|
|---|
| 34 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.