]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/memchr.3
Wrap long lines; start sentences on new lines
[thirdparty/man-pages.git] / man3 / memchr.3
CommitLineData
fea681da
MK
1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2.\"
3.\" Permission is granted to make and distribute verbatim copies of this
4.\" manual provided the copyright notice and this permission notice are
5.\" preserved on all copies.
6.\"
7.\" Permission is granted to copy and distribute modified versions of this
8.\" manual under the conditions for verbatim copying, provided that the
9.\" entire resulting derived work is distributed under the terms of a
10.\" permission notice identical to this one.
c13182ef 11.\"
fea681da
MK
12.\" Since the Linux kernel and libraries are constantly changing, this
13.\" manual page may be incorrect or out-of-date. The author(s) assume no
14.\" responsibility for errors or omissions, or for damages resulting from
15.\" the use of the information contained herein. The author(s) may not
16.\" have taken the same level of care in the production of this manual,
17.\" which is licensed free of charge, as they might when working
18.\" professionally.
c13182ef 19.\"
fea681da
MK
20.\" Formatted or processed versions of this manual, if unaccompanied by
21.\" the source, must acknowledge the copyright and authors of this work.
22.\"
23.\" Modified Mon Apr 12 12:49:57 1993, David Metcalfe
24.\" Modified Sat Jul 24 18:56:22 1993, Rik Faith (faith@cs.unc.edu)
25.\" Modified Wed Feb 20 21:09:36 2002, Ian Redfern (redferni@logica.com)
26.\"
27.TH MEMCHR 3 2003-11-01 "" "Linux Programmer's Manual"
28.SH NAME
29memchr, memrchr \- scan memory for a character
30.SH SYNOPSIS
31.nf
32.B #include <string.h>
33.sp
34.BI "void *memchr(const void *" s ", int " c ", size_t " n );
35.sp
36.BI "void *memrchr(const void *" s ", int " c ", size_t " n );
37.fi
38.SH DESCRIPTION
c13182ef 39The
63aa9df0 40.BR memchr ()
fea681da 41function scans the first \fIn\fP bytes of the memory
1c44bd5b
MK
42area pointed to by \fIs\fP for the character \fIc\fP.
43The first byte to
fea681da
MK
44match \fIc\fP (interpreted as an unsigned character) stops the operation.
45.PP
c13182ef 46The
63aa9df0 47.BR memrchr ()
c13182ef 48function is like the
63aa9df0 49.BR memchr ()
fea681da
MK
50function,
51except that it searches backwards from the end of the \fIn\fP bytes
52pointed to by \fIs\fP instead of forwards from the front.
53.SH "RETURN VALUE"
63aa9df0 54The \fBmemchr\fP() and \fBmemrchr\fP() functions return a pointer
fea681da
MK
55to the matching byte or NULL if the character does not occur in
56the given memory area.
57.SH "CONFORMING TO"
c13182ef 58The
63aa9df0 59.BR memchr ()
1eb85d14 60function conforms to SVr4, 4.3BSD, C89, C99, POSIX.1-2001.
c13182ef 61The
63aa9df0 62.BR memrchr ()
fea681da
MK
63function is a GNU extension, available since glibc 2.1.91.
64.SH "SEE ALSO"
65.BR index (3),
66.BR rindex (3),
67.BR strchr (3),
68.BR strpbrk (3),
69.BR strrchr (3),
70.BR strsep (3),
71.BR strspn (3),
72.BR strstr (3),
73.BR wmemchr (3)