xref: /freebsd/lib/libc/string/memmem.3 (revision 8fbf3d50e331929dfa82912749a2a5ce240d475b)
16050c8feSAndre Oppermann.\" Copyright (c) 2005 Pascal Gloor <pascal.gloor@spale.com>
26050c8feSAndre Oppermann.\"
36050c8feSAndre Oppermann.\" Redistribution and use in source and binary forms, with or without
46050c8feSAndre Oppermann.\" modification, are permitted provided that the following conditions
56050c8feSAndre Oppermann.\" are met:
66050c8feSAndre Oppermann.\" 1. Redistributions of source code must retain the above copyright
76050c8feSAndre Oppermann.\"    notice, this list of conditions and the following disclaimer.
86050c8feSAndre Oppermann.\" 2. Redistributions in binary form must reproduce the above copyright
96050c8feSAndre Oppermann.\"    notice, this list of conditions and the following disclaimer in the
106050c8feSAndre Oppermann.\"    documentation and/or other materials provided with the distribution.
116050c8feSAndre Oppermann.\" 3. The name of the author may not be used to endorse or promote
126050c8feSAndre Oppermann.\"    products derived from this software without specific prior written
136050c8feSAndre Oppermann.\"    permission.
146050c8feSAndre Oppermann.\"
156050c8feSAndre Oppermann.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
166050c8feSAndre Oppermann.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
176050c8feSAndre Oppermann.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
186050c8feSAndre Oppermann.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
196050c8feSAndre Oppermann.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
206050c8feSAndre Oppermann.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
216050c8feSAndre Oppermann.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
226050c8feSAndre Oppermann.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
236050c8feSAndre Oppermann.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
246050c8feSAndre Oppermann.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
256050c8feSAndre Oppermann.\" SUCH DAMAGE.
266050c8feSAndre Oppermann.\"
27ca513774SRuslan Ermilov.\" $FreeBSD$
286050c8feSAndre Oppermann.\"
296050c8feSAndre Oppermann.Dd August 24, 2005
306050c8feSAndre Oppermann.Dt MEMMEM 3
316050c8feSAndre Oppermann.Os
326050c8feSAndre Oppermann.Sh NAME
336050c8feSAndre Oppermann.Nm memmem
34ca513774SRuslan Ermilov.Nd "locate a byte substring in a byte string"
356050c8feSAndre Oppermann.Sh LIBRARY
366050c8feSAndre Oppermann.Lb libc
376050c8feSAndre Oppermann.Sh SYNOPSIS
386050c8feSAndre Oppermann.In string.h
39ca513774SRuslan Ermilov.Ft "void *"
40ca513774SRuslan Ermilov.Fo memmem
4136c71f6aSRuslan Ermilov.Fa "const void *big" "size_t big_len"
4236c71f6aSRuslan Ermilov.Fa "const void *little" "size_t little_len"
43ca513774SRuslan Ermilov.Fc
446050c8feSAndre Oppermann.Sh DESCRIPTION
456050c8feSAndre OppermannThe
466050c8feSAndre Oppermann.Fn memmem
476050c8feSAndre Oppermannfunction
486050c8feSAndre Oppermannlocates the first occurrence of the byte string
496050c8feSAndre Oppermann.Fa little
506050c8feSAndre Oppermannin the byte string
516050c8feSAndre Oppermann.Fa big .
526050c8feSAndre Oppermann.Sh RETURN VALUES
536050c8feSAndre OppermannIf
546050c8feSAndre Oppermann.Fa big_len
556050c8feSAndre Oppermannis smaller than
566050c8feSAndre Oppermann.Fa little_len ,
576050c8feSAndre Oppermannif
586050c8feSAndre Oppermann.Fa little_len
596050c8feSAndre Oppermannis 0, if
606050c8feSAndre Oppermann.Fa big_len
616050c8feSAndre Oppermannis 0 or if
626050c8feSAndre Oppermann.Fa little
636050c8feSAndre Oppermannoccurs nowhere in
646050c8feSAndre Oppermann.Fa big ,
656050c8feSAndre Oppermann.Dv NULL
666050c8feSAndre Oppermannis returned;
676050c8feSAndre Oppermannotherwise a pointer to the first character of the first occurrence of
686050c8feSAndre Oppermann.Fa little
696050c8feSAndre Oppermannis returned.
706050c8feSAndre Oppermann.Sh SEE ALSO
716050c8feSAndre Oppermann.Xr memchr 3 ,
726050c8feSAndre Oppermann.Xr strchr 3 ,
736050c8feSAndre Oppermann.Xr strstr 3
746050c8feSAndre Oppermann.Sh CONFORMING TO
756050c8feSAndre Oppermann.Fn memmem
766050c8feSAndre Oppermannis a GNU extension.
776050c8feSAndre Oppermann.Sh HISTORY
786050c8feSAndre OppermannThe
796050c8feSAndre Oppermann.Fn memmem
806050c8feSAndre Oppermannfunction first appeared in
816050c8feSAndre Oppermann.Fx 6.0 .
82ca513774SRuslan Ermilov.Sh AUTHORS
83*8fbf3d50SBaptiste Daroussin.An Pascal Gloor Aq Mt pascal.gloor@spale.com
846050c8feSAndre Oppermann.Sh BUGS
856050c8feSAndre OppermannThis function was broken in Linux libc up to and including version 5.0.9
866050c8feSAndre Oppermannand in GNU libc prior to version 2.1.
87