]> git.saurik.com Git - apple/libc.git/blob - string/FreeBSD/strstr.3.patch
Libc-763.13.tar.gz
[apple/libc.git] / string / FreeBSD / strstr.3.patch
1 --- strstr.3.bsdnew 2009-11-30 13:52:24.000000000 -0800
2 +++ strstr.3 2009-11-30 14:58:48.000000000 -0800
3 @@ -37,26 +37,47 @@
4 .Dt STRSTR 3
5 .Os
6 .Sh NAME
7 -.Nm strstr , strcasestr , strnstr
8 +.Nm strcasestr ,
9 +.Nm strcasestr_l ,
10 +.Nm strnstr ,
11 +.Nm strstr
12 .Nd locate a substring in a string
13 .Sh LIBRARY
14 .Lb libc
15 .Sh SYNOPSIS
16 .In string.h
17 .Ft char *
18 -.Fn strstr "const char *big" "const char *little"
19 +.Fo strcasestr
20 +.Fa "const char *s1"
21 +.Fa "const char *s2"
22 +.Fc
23 .Ft char *
24 -.Fn strcasestr "const char *big" "const char *little"
25 +.Fo strnstr
26 +.Fa "const char *s1"
27 +.Fa "const char *s2"
28 +.Fa "size_t n"
29 +.Fc
30 .Ft char *
31 -.Fn strnstr "const char *big" "const char *little" "size_t len"
32 +.Fo strstr
33 +.Fa "const char *s1"
34 +.Fa "const char *s2"
35 +.Fc
36 +.In string.h
37 +.In xlocale.h
38 +.Ft char *
39 +.Fo strcasestr_l
40 +.Fa "const char *s1"
41 +.Fa "const char *s2"
42 +.Fa "locale_t loc"
43 +.Fc
44 .Sh DESCRIPTION
45 The
46 .Fn strstr
47 function
48 locates the first occurrence of the null-terminated string
49 -.Fa little
50 +.Fa s2
51 in the null-terminated string
52 -.Fa big .
53 +.Fa s1 .
54 .Pp
55 The
56 .Fn strcasestr
57 @@ -68,11 +89,11 @@ The
58 .Fn strnstr
59 function
60 locates the first occurrence of the null-terminated string
61 -.Fa little
62 +.Fa s2
63 in the string
64 -.Fa big ,
65 +.Fa s1 ,
66 where not more than
67 -.Fa len
68 +.Fa n
69 characters are searched.
70 Characters that appear after a
71 .Ql \e0
72 @@ -82,20 +103,28 @@ Since the
73 function is a
74 .Fx
75 specific API, it should only be used when portability is not a concern.
76 +.Pp
77 +While the
78 +.Fn strcasestr
79 +function uses the current locale, the
80 +.Fn strcasestr_l
81 +function may be passed a locale directly. See
82 +.Xr xlocale 3
83 +for more information.
84 .Sh RETURN VALUES
85 If
86 -.Fa little
87 +.Fa s2
88 is an empty string,
89 -.Fa big
90 +.Fa s1
91 is returned;
92 if
93 -.Fa little
94 +.Fa s2
95 occurs nowhere in
96 -.Fa big ,
97 +.Fa s1 ,
98 .Dv NULL
99 is returned;
100 otherwise a pointer to the first character of the first occurrence of
101 -.Fa little
102 +.Fa s2
103 is returned.
104 .Sh EXAMPLES
105 The following sets the pointer
106 @@ -128,7 +157,6 @@ ptr = strnstr(largestring, smallstring,
107 .Ed
108 .Sh SEE ALSO
109 .Xr memchr 3 ,
110 -.Xr memmem 3 ,
111 .Xr strchr 3 ,
112 .Xr strcspn 3 ,
113 .Xr strpbrk 3 ,
114 @@ -136,7 +164,8 @@ ptr = strnstr(largestring, smallstring,
115 .Xr strsep 3 ,
116 .Xr strspn 3 ,
117 .Xr strtok 3 ,
118 -.Xr wcsstr 3
119 +.Xr wcsstr 3 ,
120 +.Xr xlocale 3
121 .Sh STANDARDS
122 The
123 .Fn strstr