summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/memchr.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/string/memchr.3')
-rw-r--r--src/lib/libc/string/memchr.347
1 files changed, 29 insertions, 18 deletions
diff --git a/src/lib/libc/string/memchr.3 b/src/lib/libc/string/memchr.3
index 265711e3b5..558848ac23 100644
--- a/src/lib/libc/string/memchr.3
+++ b/src/lib/libc/string/memchr.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,10 +29,9 @@
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: @(#)memchr.3 5.4 (Berkeley) 6/29/91 32.\" $OpenBSD: memchr.3,v 1.9 2007/09/03 16:50:14 jmc Exp $
37.\" $Id: memchr.3,v 1.1.1.1 1995/10/18 08:42:21 deraadt Exp $
38.\" 33.\"
39.Dd June 29, 1991 34.Dd $Mdocdate: September 3 2007 $
40.Dt MEMCHR 3 35.Dt MEMCHR 3
41.Os 36.Os
42.Sh NAME 37.Sh NAME
@@ -46,26 +41,37 @@
46.Fd #include <string.h> 41.Fd #include <string.h>
47.Ft void * 42.Ft void *
48.Fn memchr "const void *b" "int c" "size_t len" 43.Fn memchr "const void *b" "int c" "size_t len"
44.Ft void *
45.Fn memrchr "const void *b" "int c" "size_t len"
49.Sh DESCRIPTION 46.Sh DESCRIPTION
50The 47The
51.Fn memchr 48.Fn memchr
52function 49function locates the first occurrence of
53locates the first occurrence of 50.Fa c
51(converted to an
52.Li unsigned char )
53in string
54.Fa b .
55.Pp
56The
57.Fn memrchr
58function behaves like
59.Fn memchr ,
60except that it locates the last occurrence of
54.Fa c 61.Fa c
55(converted to an unsigned char)
56in string 62in string
57.Fa b . 63.Fa b .
58.Sh RETURN VALUES 64.Sh RETURN VALUES
59The 65The
60.Fn memchr 66.Fn memchr
61function 67and
62returns a pointer to the byte located, 68.Fn memrchr
63or NULL if no such byte exists within 69functions return a pointer to the byte located, or
70.Dv NULL
71if no such byte exists within
64.Fa len 72.Fa len
65bytes. 73bytes.
66.Sh SEE ALSO 74.Sh SEE ALSO
67.Xr index 3 ,
68.Xr rindex 3 ,
69.Xr strchr 3 , 75.Xr strchr 3 ,
70.Xr strcspn 3 , 76.Xr strcspn 3 ,
71.Xr strpbrk 3 , 77.Xr strpbrk 3 ,
@@ -77,6 +83,11 @@ bytes.
77.Sh STANDARDS 83.Sh STANDARDS
78The 84The
79.Fn memchr 85.Fn memchr
80function 86function conforms to
81conforms to
82.St -ansiC . 87.St -ansiC .
88.Pp
89The
90.Fn memrchr
91function is an
92.Ox
93extension.