Penguin
Annotated edit history of memmem(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 MEMMEM
2 !!!MEMMEM
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 CONFORMING TO
8 BUGS
9 SEE ALSO
10 ----
11 !!NAME
12
13
14 memmem - locate a substring
15 !!SYNOPSIS
16
17
18 __#define _GNU_SOURCE
19 #include
20 __''haystack''__, size_t__ ''haystacklen''__,
21 const void *__''needle''__, size_t__ ''needlelen''__);
22 __
23 !!DESCRIPTION
24
25
26 The __memmem()__ function finds the start of the first
27 occurrence of the substring ''needle'' of length
28 ''needlelen'' in the memory area ''haystack'' of
29 length ''haystacklen''.
30 !!RETURN VALUE
31
32
33 The __memmem()__ function returns a pointer to the
34 beginning of the substring, or NULL if the substring is not
35 found.
36 !!CONFORMING TO
37
38
39 This function is a GNU extension.
40 !!BUGS
41
42
43 This function was broken in Linux libraries up to and
44 including libc 5.0.9; there the `needle' and `haystack'
45 arguments were interchanged, and a pointer to the end of the
46 first occurrence of ''needle'' was returned. Since libc
47 5.0.9 is still widely used, this is a dangerous function to
48 use.
49 Both old and new libc's have the bug that if ''needle''
50 is empty ''haystack''-1 (instead of ''haystack'') is
51 returned. And glibc 2.0 makes it worse, and returns a
52 pointer to the last byte of `haystack'. This is fixed in
53 glibc 2.1.
54 !!SEE ALSO
55
56
57 strstr(3)
58 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.