OSDN Git Service

(split) LDP man-pages の original/ を v3.29 に更新。
[linuxjm/LDP_man-pages.git] / original / man3 / strstr.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified Sat Jul 24 17:56:43 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Added history, aeb, 980113.
29 .\" 2005-05-05 mtk: added strcasestr()
30 .\"
31 .TH STRSTR 3  2010-09-20 "GNU" "Linux Programmer's Manual"
32 .SH NAME
33 strstr, strcasestr \- locate a substring
34 .SH SYNOPSIS
35 .nf
36 .B #include <string.h>
37 .sp
38 .BI "char *strstr(const char *" haystack ", const char *" needle );
39 .sp
40 .B #define _GNU_SOURCE
41 .sp
42 .B #include <string.h>
43 .sp
44 .BI "char *strcasestr(const char *" haystack ", const char *" needle );
45 .fi
46 .SH DESCRIPTION
47 The
48 .BR strstr ()
49 function finds the first occurrence of the substring
50 \fIneedle\fP in the string \fIhaystack\fP.
51 The terminating \(aq\\0\(aq characters are not compared.
52
53 The
54 .BR strcasestr ()
55 function is like
56 .BR strstr (),
57 but ignores the case of both arguments.
58 .SH "RETURN VALUE"
59 These functions return a pointer to the beginning of the
60 substring, or NULL if the substring is not found.
61 .SH "CONFORMING TO"
62 The
63 .BR strstr ()
64 function conforms to C89 and C99.
65 The
66 .BR strcasestr ()
67 function is a nonstandard extension.
68 .SH BUGS
69 Early versions of Linux libc (like 4.5.26) would not allow
70 an empty \fIneedle\fP argument for
71 .BR strstr ().
72 Later versions (like 4.6.27) work correctly,
73 and return \fIhaystack\fP when \fIneedle\fP is empty.
74 .SH "SEE ALSO"
75 .BR index (3),
76 .BR memchr (3),
77 .BR rindex (3),
78 .BR strcasecmp (3),
79 .BR strchr (3),
80 .BR string (3),
81 .BR strpbrk (3),
82 .BR strsep (3),
83 .BR strspn (3),
84 .BR strtok (3),
85 .BR wcsstr (3),
86 .BR feature_test_macros (7)