summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraaron <>1999-06-04 17:26:27 +0000
committeraaron <>1999-06-04 17:26:27 +0000
commitb54ee9c910d2afd114c02825c362ba253d8bf917 (patch)
treeebcba47bac644d62639dc613eddfb560f2e15f5f
parenta75229263ddbca710a9fdffc776c5bfdad7c5dfe (diff)
downloadopenbsd-b54ee9c910d2afd114c02825c362ba253d8bf917.tar.gz
openbsd-b54ee9c910d2afd114c02825c362ba253d8bf917.tar.bz2
openbsd-b54ee9c910d2afd114c02825c362ba253d8bf917.zip
add examples
-rw-r--r--src/lib/libc/string/strchr.332
-rw-r--r--src/lib/libc/string/strrchr.331
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
49The 49The
50.Fn strchr 50.Fn strchr
51function locates the first occurrence of 51function locates the first occurrence of the character
52.Ar c 52.Fa c
53in the string pointed to by 53in the string
54.Ar s . 54.Fa s .
55The terminating 55The terminating NUL character is considered part of the string.
56.Dv NUL
57character is considered part of the string.
58If 56If
59.Fa c 57.Fa c
60is 58is
@@ -63,11 +61,23 @@ is
63locates the terminating 61locates the terminating
64.Ql \e0 . 62.Ql \e0 .
65.Sh RETURN VALUES 63.Sh RETURN VALUES
66The function 64The
67.Fn strchr 65.Fn strchr
68returns a pointer to the located character, or 66function returns a pointer to the located character or
69.Dv NULL 67.Dv NULL
70if the character does not appear in the string. 68if the character does not appear in the string.
69.Sh EXAMPLES
70After the following call to
71.Fn strchr ,
72.Va p
73will point to the string
74.Qq oobar :
75.Bd -literal -offset indent
76char *p;
77char *s = "foobar";
78
79p = 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
49The 49The
50.Fn strrchr 50.Fn strrchr
51function 51function locates the last occurrence of the character
52locates the last occurrence of
53.Fa c 52.Fa c
54(converted to a char)
55in the string 53in the string
56.Fa s . 54.Fa s .
55The terminating NUL character is considered part of the string.
57If 56If
58.Fa c 57.Fa c
59is 58is
@@ -64,13 +63,21 @@ locates the terminating
64.Sh RETURN VALUES 63.Sh RETURN VALUES
65The 64The
66.Fn strrchr 65.Fn strrchr
67function 66function returns a pointer to the located character or
68returns a pointer to the character, 67.Dv NULL
69or a null 68if the character does not appear in the string.
70pointer if 69.Sh EXAMPLES
71.Fa c 70After the following call to
72does not occur anywhere in 71.Fn strrchr ,
73.Fa s . 72.Va p
73will point to the string
74.Qq obar :
75.Bd -literal -offset indent
76char *p;
77char *s = "foobar";
78
79p = 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 ,