diff options
Diffstat (limited to 'src/lib/libc')
| -rw-r--r-- | src/lib/libc/string/strchr.3 | 32 | ||||
| -rw-r--r-- | src/lib/libc/string/strrchr.3 | 31 |
2 files changed, 40 insertions, 23 deletions
diff --git a/src/lib/libc/string/strchr.3 b/src/lib/libc/string/strchr.3 index c3bc2f8817..f4b4aef976 100644 --- a/src/lib/libc/string/strchr.3 +++ b/src/lib/libc/string/strchr.3 | |||
| @@ -33,14 +33,14 @@ | |||
| 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | .\" SUCH DAMAGE. | 34 | .\" SUCH DAMAGE. |
| 35 | .\" | 35 | .\" |
| 36 | .\" $OpenBSD: strchr.3,v 1.3 1997/12/29 22:31:50 deraadt Exp $ | 36 | .\" $OpenBSD: strchr.3,v 1.4 1999/06/04 17:26:26 aaron Exp $ |
| 37 | .\" | 37 | .\" |
| 38 | .Dd June 29, 1991 | 38 | .Dd June 29, 1991 |
| 39 | .Dt STRCHR 3 | 39 | .Dt STRCHR 3 |
| 40 | .Os | 40 | .Os |
| 41 | .Sh NAME | 41 | .Sh NAME |
| 42 | .Nm strchr | 42 | .Nm strchr |
| 43 | .Nd locate character in string | 43 | .Nd locate first occurence of a character in a string |
| 44 | .Sh SYNOPSIS | 44 | .Sh SYNOPSIS |
| 45 | .Fd #include <string.h> | 45 | .Fd #include <string.h> |
| 46 | .Ft char * | 46 | .Ft char * |
| @@ -48,13 +48,11 @@ | |||
| 48 | .Sh DESCRIPTION | 48 | .Sh DESCRIPTION |
| 49 | The | 49 | The |
| 50 | .Fn strchr | 50 | .Fn strchr |
| 51 | function locates the first occurrence of | 51 | function locates the first occurrence of the character |
| 52 | .Ar c | 52 | .Fa c |
| 53 | in the string pointed to by | 53 | in the string |
| 54 | .Ar s . | 54 | .Fa s . |
| 55 | The terminating | 55 | The terminating NUL character is considered part of the string. |
| 56 | .Dv NUL | ||
| 57 | character is considered part of the string. | ||
| 58 | If | 56 | If |
| 59 | .Fa c | 57 | .Fa c |
| 60 | is | 58 | is |
| @@ -63,11 +61,23 @@ is | |||
| 63 | locates the terminating | 61 | locates the terminating |
| 64 | .Ql \e0 . | 62 | .Ql \e0 . |
| 65 | .Sh RETURN VALUES | 63 | .Sh RETURN VALUES |
| 66 | The function | 64 | The |
| 67 | .Fn strchr | 65 | .Fn strchr |
| 68 | returns a pointer to the located character, or | 66 | function returns a pointer to the located character or |
| 69 | .Dv NULL | 67 | .Dv NULL |
| 70 | if the character does not appear in the string. | 68 | if the character does not appear in the string. |
| 69 | .Sh EXAMPLES | ||
| 70 | After the following call to | ||
| 71 | .Fn strchr , | ||
| 72 | .Va p | ||
| 73 | will point to the string | ||
| 74 | .Qq oobar : | ||
| 75 | .Bd -literal -offset indent | ||
| 76 | char *p; | ||
| 77 | char *s = "foobar"; | ||
| 78 | |||
| 79 | p = strchr(s, 'o'); | ||
| 80 | .Ed | ||
| 71 | .Sh SEE ALSO | 81 | .Sh SEE ALSO |
| 72 | .Xr index 3 , | 82 | .Xr index 3 , |
| 73 | .Xr memchr 3 , | 83 | .Xr memchr 3 , |
diff --git a/src/lib/libc/string/strrchr.3 b/src/lib/libc/string/strrchr.3 index 6dd00d32fb..4494728bdd 100644 --- a/src/lib/libc/string/strrchr.3 +++ b/src/lib/libc/string/strrchr.3 | |||
| @@ -33,14 +33,14 @@ | |||
| 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | .\" SUCH DAMAGE. | 34 | .\" SUCH DAMAGE. |
| 35 | .\" | 35 | .\" |
| 36 | .\" $OpenBSD: strrchr.3,v 1.2 1996/08/19 08:34:23 tholo Exp $ | 36 | .\" $OpenBSD: strrchr.3,v 1.3 1999/06/04 17:26:27 aaron Exp $ |
| 37 | .\" | 37 | .\" |
| 38 | .Dd June 29, 1991 | 38 | .Dd June 29, 1991 |
| 39 | .Dt STRRCHR 3 | 39 | .Dt STRRCHR 3 |
| 40 | .Os | 40 | .Os |
| 41 | .Sh NAME | 41 | .Sh NAME |
| 42 | .Nm strrchr | 42 | .Nm strrchr |
| 43 | .Nd locate character in string | 43 | .Nd locate last occurence of a character in a string |
| 44 | .Sh SYNOPSIS | 44 | .Sh SYNOPSIS |
| 45 | .Fd #include <string.h> | 45 | .Fd #include <string.h> |
| 46 | .Ft char * | 46 | .Ft char * |
| @@ -48,12 +48,11 @@ | |||
| 48 | .Sh DESCRIPTION | 48 | .Sh DESCRIPTION |
| 49 | The | 49 | The |
| 50 | .Fn strrchr | 50 | .Fn strrchr |
| 51 | function | 51 | function locates the last occurrence of the character |
| 52 | locates the last occurrence of | ||
| 53 | .Fa c | 52 | .Fa c |
| 54 | (converted to a char) | ||
| 55 | in the string | 53 | in the string |
| 56 | .Fa s . | 54 | .Fa s . |
| 55 | The terminating NUL character is considered part of the string. | ||
| 57 | If | 56 | If |
| 58 | .Fa c | 57 | .Fa c |
| 59 | is | 58 | is |
| @@ -64,13 +63,21 @@ locates the terminating | |||
| 64 | .Sh RETURN VALUES | 63 | .Sh RETURN VALUES |
| 65 | The | 64 | The |
| 66 | .Fn strrchr | 65 | .Fn strrchr |
| 67 | function | 66 | function returns a pointer to the located character or |
| 68 | returns a pointer to the character, | 67 | .Dv NULL |
| 69 | or a null | 68 | if the character does not appear in the string. |
| 70 | pointer if | 69 | .Sh EXAMPLES |
| 71 | .Fa c | 70 | After the following call to |
| 72 | does not occur anywhere in | 71 | .Fn strrchr , |
| 73 | .Fa s . | 72 | .Va p |
| 73 | will point to the string | ||
| 74 | .Qq obar : | ||
| 75 | .Bd -literal -offset indent | ||
| 76 | char *p; | ||
| 77 | char *s = "foobar"; | ||
| 78 | |||
| 79 | p = strrchr(s, 'o'); | ||
| 80 | .Ed | ||
| 74 | .Sh SEE ALSO | 81 | .Sh SEE ALSO |
| 75 | .Xr index 3 , | 82 | .Xr index 3 , |
| 76 | .Xr memchr 3 , | 83 | .Xr memchr 3 , |
