2 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" References consulted:
7 .\" Linux libc source code
9 .\" Modified Sat Jul 24 18:50:48 1993 by Rik Faith (faith@cs.unc.edu)
10 .\" Interchanged 'needle' and 'haystack'; added history, aeb, 980113.
11 .TH memmem 3 (date) "Linux man-pages (unreleased)"
13 memmem \- locate a substring
16 .RI ( libc ", " \-lc )
19 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
20 .B #include <string.h>
22 .BI "void *memmem(const void " haystack [. haystacklen "], size_t " haystacklen ,
23 .BI " const void " needle [. needlelen "], size_t " needlelen );
28 function finds the start of the first occurrence
41 function returns a pointer to the beginning of the
42 substring, or NULL if the substring is not found.
44 For an explanation of the terms used in this section, see
52 Interface Attribute Value
55 T} Thread safety MT-Safe
61 This function is not specified in POSIX.1,
62 but is present on a number of other systems,
65 FreeBSD 6.0, OpenBSD 5.4, NetBSD, and Illumos.
67 .\" This function was broken in Linux libraries up to and including libc 5.0.9;
72 .\" arguments were interchanged,
73 .\" and a pointer to the end of the first occurrence of
77 .\" Both old and new libc's have the bug that if
88 returns a pointer to the last byte of
90 This is fixed in glibc 2.1.