xref: /freebsd/lib/libc/string/memmem.3 (revision 6050c8fe05cff5f6b5d0191db51223f86b7c04f0)
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.\"
276050c8feSAndre Oppermann\" $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
346050c8feSAndre Oppermann.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
396050c8feSAndre Oppermann.Ft void *
406050c8feSAndre Oppermann.Fn memmem "const char *big" "size_t big_len" \
416050c8feSAndre Oppermann"const char *little" "size_t little_len"
426050c8feSAndre Oppermann.Sh DESCRIPTION
436050c8feSAndre OppermannThe
446050c8feSAndre Oppermann.Fn memmem
456050c8feSAndre Oppermannfunction
466050c8feSAndre Oppermannlocates the first occurrence of the byte string
476050c8feSAndre Oppermann.Fa little
486050c8feSAndre Oppermannin the byte string
496050c8feSAndre Oppermann.Fa big .
506050c8feSAndre Oppermann.Sh RETURN VALUES
516050c8feSAndre OppermannIf
526050c8feSAndre Oppermann.Fa big_len
536050c8feSAndre Oppermannis smaller than
546050c8feSAndre Oppermann.Fa little_len ,
556050c8feSAndre Oppermannif
566050c8feSAndre Oppermann.Fa little_len
576050c8feSAndre Oppermannis 0, if
586050c8feSAndre Oppermann.Fa big_len
596050c8feSAndre Oppermannis 0 or if
606050c8feSAndre Oppermann.Fa little
616050c8feSAndre Oppermannoccurs nowhere in
626050c8feSAndre Oppermann.Fa big ,
636050c8feSAndre Oppermann.Dv NULL
646050c8feSAndre Oppermannis returned;
656050c8feSAndre Oppermannotherwise a pointer to the first character of the first occurrence of
666050c8feSAndre Oppermann.Fa little
676050c8feSAndre Oppermannis returned.
686050c8feSAndre Oppermann.Sh SEE ALSO
696050c8feSAndre Oppermann.Xr memchr 3 ,
706050c8feSAndre Oppermann.Xr strchr 3 ,
716050c8feSAndre Oppermann.Xr strstr 3
726050c8feSAndre Oppermann.Sh CONFORMING TO
736050c8feSAndre Oppermann.Fn memmem
746050c8feSAndre Oppermannis a GNU extension.
756050c8feSAndre Oppermann.Sh HISTORY
766050c8feSAndre OppermannThe
776050c8feSAndre Oppermann.Fn memmem
786050c8feSAndre Oppermannfunction first appeared in
796050c8feSAndre Oppermann.Fx 6.0 .
806050c8feSAndre Oppermann.Sh AUTHOR
816050c8feSAndre OppermannPascal Gloor <pascal.gloor@spale.com>
826050c8feSAndre Oppermann.Sh BUGS
836050c8feSAndre OppermannThis function was broken in Linux libc up to and including version 5.0.9
846050c8feSAndre Oppermannand in GNU libc prior to version 2.1.
85