diff options
Diffstat (limited to 'src/lib/libc/string/strrchr.3')
| -rw-r--r-- | src/lib/libc/string/strrchr.3 | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/src/lib/libc/string/strrchr.3 b/src/lib/libc/string/strrchr.3 index 1d98cbff24..0d1f4be971 100644 --- a/src/lib/libc/string/strrchr.3 +++ b/src/lib/libc/string/strrchr.3 | |||
| @@ -13,11 +13,7 @@ | |||
| 13 | .\" 2. Redistributions in binary form must reproduce the above copyright | 13 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| 14 | .\" notice, this list of conditions and the following disclaimer in the | 14 | .\" notice, this list of conditions and the following disclaimer in the |
| 15 | .\" documentation and/or other materials provided with the distribution. | 15 | .\" documentation and/or other materials provided with the distribution. |
| 16 | .\" 3. All advertising materials mentioning features or use of this software | 16 | .\" 3. Neither the name of the University nor the names of its contributors |
| 17 | .\" must display the following acknowledgement: | ||
| 18 | .\" This product includes software developed by the University of | ||
| 19 | .\" California, Berkeley and its contributors. | ||
| 20 | .\" 4. Neither the name of the University nor the names of its contributors | ||
| 21 | .\" may be used to endorse or promote products derived from this software | 17 | .\" may be used to endorse or promote products derived from this software |
| 22 | .\" without specific prior written permission. | 18 | .\" without specific prior written permission. |
| 23 | .\" | 19 | .\" |
| @@ -33,28 +29,31 @@ | |||
| 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | .\" SUCH DAMAGE. | 30 | .\" SUCH DAMAGE. |
| 35 | .\" | 31 | .\" |
| 36 | .\" from: @(#)strrchr.3 5.3 (Berkeley) 6/29/91 | 32 | .\" $OpenBSD: strrchr.3,v 1.8 2007/05/31 19:19:32 jmc Exp $ |
| 37 | .\" $Id: strrchr.3,v 1.1.1.1 1995/10/18 08:42:23 deraadt Exp $ | ||
| 38 | .\" | 33 | .\" |
| 39 | .Dd June 29, 1991 | 34 | .Dd $Mdocdate: May 31 2007 $ |
| 40 | .Dt STRRCHR 3 | 35 | .Dt STRRCHR 3 |
| 41 | .Os | 36 | .Os |
| 42 | .Sh NAME | 37 | .Sh NAME |
| 43 | .Nm strrchr | 38 | .Nm strrchr , |
| 44 | .Nd locate character in string | 39 | .Nm rindex |
| 40 | .Nd locate last occurrence of a character in a string | ||
| 45 | .Sh SYNOPSIS | 41 | .Sh SYNOPSIS |
| 46 | .Fd #include <string.h> | 42 | .Fd #include <string.h> |
| 47 | .Ft char * | 43 | .Ft char * |
| 48 | .Fn strrchr "const char *s" "int c" | 44 | .Fn strrchr "const char *s" "int c" |
| 45 | .Ft char * | ||
| 46 | .Fn rindex "const char *s" "int c" | ||
| 49 | .Sh DESCRIPTION | 47 | .Sh DESCRIPTION |
| 50 | The | 48 | The |
| 51 | .Fn strrchr | 49 | .Fn strrchr |
| 52 | function | 50 | function locates the last occurrence of the character |
| 53 | locates the last occurrence of | ||
| 54 | .Fa c | 51 | .Fa c |
| 55 | (converted to a char) | ||
| 56 | in the string | 52 | in the string |
| 57 | .Fa s . | 53 | .Fa s . |
| 54 | The terminating | ||
| 55 | .Tn NUL | ||
| 56 | character is considered part of the string. | ||
| 58 | If | 57 | If |
| 59 | .Fa c | 58 | .Fa c |
| 60 | is | 59 | is |
| @@ -62,20 +61,31 @@ is | |||
| 62 | .Fn strrchr | 61 | .Fn strrchr |
| 63 | locates the terminating | 62 | locates the terminating |
| 64 | .Ql \e0 . | 63 | .Ql \e0 . |
| 64 | .Pp | ||
| 65 | The | ||
| 66 | .Fn rindex | ||
| 67 | function is an old synonym for | ||
| 68 | .Fn strrchr . | ||
| 65 | .Sh RETURN VALUES | 69 | .Sh RETURN VALUES |
| 66 | The | 70 | The |
| 67 | .Fn strrchr | 71 | .Fn strrchr |
| 68 | function | 72 | function returns a pointer to the located character or |
| 69 | returns a pointer to the character, | 73 | .Dv NULL |
| 70 | or a null | 74 | if the character does not appear in the string. |
| 71 | pointer if | 75 | .Sh EXAMPLES |
| 72 | .Fa c | 76 | After the following call to |
| 73 | does not occur anywhere in | 77 | .Fn strrchr , |
| 74 | .Fa s . | 78 | .Va p |
| 79 | will point to the string | ||
| 80 | .Qq obar : | ||
| 81 | .Bd -literal -offset indent | ||
| 82 | char *p; | ||
| 83 | char *s = "foobar"; | ||
| 84 | |||
| 85 | p = strrchr(s, 'o'); | ||
| 86 | .Ed | ||
| 75 | .Sh SEE ALSO | 87 | .Sh SEE ALSO |
| 76 | .Xr index 3 , | ||
| 77 | .Xr memchr 3 , | 88 | .Xr memchr 3 , |
| 78 | .Xr rindex 3 , | ||
| 79 | .Xr strchr 3 , | 89 | .Xr strchr 3 , |
| 80 | .Xr strcspn 3 , | 90 | .Xr strcspn 3 , |
| 81 | .Xr strpbrk 3 , | 91 | .Xr strpbrk 3 , |
| @@ -86,6 +96,9 @@ does not occur anywhere in | |||
| 86 | .Sh STANDARDS | 96 | .Sh STANDARDS |
| 87 | The | 97 | The |
| 88 | .Fn strrchr | 98 | .Fn strrchr |
| 89 | function | 99 | function conforms to |
| 90 | conforms to | ||
| 91 | .St -ansiC . | 100 | .St -ansiC . |
| 101 | .Pp | ||
| 102 | The | ||
| 103 | .Fn rindex | ||
| 104 | function is deprecated and shouldn't be used in new code. | ||
