1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" References consulted:
6 .\" Linux libc source code
8 .\" Modified Sat Jul 24 18:50:48 1993 by Rik Faith (faith@cs.unc.edu)
9 .\" Interchanged 'needle' and 'haystack'; added history, aeb, 980113.
10 .TH MEMMEM 3 2021-03-22 "Linux man-pages (unreleased)"
12 memmem \- locate a substring
15 .RI ( libc ", " \-lc )
18 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
19 .B #include <string.h>
21 .BI "void *memmem(const void *" haystack ", size_t " haystacklen ,
22 .BI " const void *" needle ", size_t " needlelen );
27 function finds the start of the first occurrence
40 function returns a pointer to the beginning of the
41 substring, or NULL if the substring is not found.
43 For an explanation of the terms used in this section, see
51 Interface Attribute Value
54 T} Thread safety MT-Safe
60 This function is not specified in POSIX.1,
61 but is present on a number of other systems.
63 .\" This function was broken in Linux libraries up to and including libc 5.0.9;
68 .\" arguments were interchanged,
69 .\" and a pointer to the end of the first occurrence of
73 .\" Both old and new libc's have the bug that if
84 returns a pointer to the last byte of
86 This is fixed in glibc 2.1.