diff options
Diffstat (limited to 'src/lib/libc/string/strstr.3')
| -rw-r--r-- | src/lib/libc/string/strstr.3 | 67 |
1 files changed, 39 insertions, 28 deletions
diff --git a/src/lib/libc/string/strstr.3 b/src/lib/libc/string/strstr.3 index 24fdf540ed..4069d55ed2 100644 --- a/src/lib/libc/string/strstr.3 +++ b/src/lib/libc/string/strstr.3 | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | .\" $OpenBSD: strstr.3,v 1.11 2011/07/25 00:38:53 schwarze Exp $ | ||
| 2 | .\" | ||
| 1 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. | 3 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. |
| 2 | .\" All rights reserved. | 4 | .\" All rights reserved. |
| 3 | .\" | 5 | .\" |
| @@ -13,11 +15,7 @@ | |||
| 13 | .\" 2. Redistributions in binary form must reproduce the above copyright | 15 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| 14 | .\" notice, this list of conditions and the following disclaimer in the | 16 | .\" notice, this list of conditions and the following disclaimer in the |
| 15 | .\" documentation and/or other materials provided with the distribution. | 17 | .\" documentation and/or other materials provided with the distribution. |
| 16 | .\" 3. All advertising materials mentioning features or use of this software | 18 | .\" 3. Neither the name of the University nor the names of its contributors |
| 17 | .\" must display the following acknowledgement: | ||
| 18 | .\" This product includes software developed by the University of | ||
| 19 | .\" California, Berkeley and its contributors. | ||
| 20 | .\" 4. Neither the name of the University nor the names of its contributors | ||
| 21 | .\" may be used to endorse or promote products derived from this software | 19 | .\" may be used to endorse or promote products derived from this software |
| 22 | .\" without specific prior written permission. | 20 | .\" without specific prior written permission. |
| 23 | .\" | 21 | .\" |
| @@ -33,57 +31,70 @@ | |||
| 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | .\" SUCH DAMAGE. | 32 | .\" SUCH DAMAGE. |
| 35 | .\" | 33 | .\" |
| 36 | .\" from: @(#)strstr.3 5.3 (Berkeley) 6/29/91 | 34 | .Dd $Mdocdate: July 25 2011 $ |
| 37 | .\" $Id: strstr.3,v 1.1.1.1 1995/10/18 08:42:23 deraadt Exp $ | ||
| 38 | .\" | ||
| 39 | .Dd June 29, 1991 | ||
| 40 | .Dt STRSTR 3 | 35 | .Dt STRSTR 3 |
| 41 | .Os | 36 | .Os |
| 42 | .Sh NAME | 37 | .Sh NAME |
| 43 | .Nm strstr | 38 | .Nm strstr , strcasestr |
| 44 | .Nd locate a substring in a string | 39 | .Nd locate a substring in a string |
| 45 | .Sh SYNOPSIS | 40 | .Sh SYNOPSIS |
| 46 | .Fd #include <string.h> | 41 | .Fd #include <string.h> |
| 47 | .Ft char * | 42 | .Ft char * |
| 48 | .Fn strstr "const char *big" "const char *little" | 43 | .Fn strstr "const char *big" "const char *little" |
| 44 | .Ft char * | ||
| 45 | .Fn strcasestr "const char *big" "const char *little" | ||
| 49 | .Sh DESCRIPTION | 46 | .Sh DESCRIPTION |
| 50 | The | 47 | The |
| 51 | .Fn strstr | 48 | .Fn strstr |
| 52 | function | 49 | function locates the first occurrence of the NUL-terminated string |
| 53 | locates the first occurrence of the null-terminated string | ||
| 54 | .Fa little | 50 | .Fa little |
| 55 | in the null-terminated string | 51 | in the NUL-terminated string |
| 56 | .Fa big . | 52 | .Fa big . |
| 53 | .Pp | ||
| 54 | The | ||
| 55 | .Fn strcasestr | ||
| 56 | function is similar to | ||
| 57 | .Fn strstr | ||
| 58 | but ignores the case of both strings. | ||
| 59 | .Pp | ||
| 57 | If | 60 | If |
| 58 | .Fa little | 61 | .Fa little |
| 59 | is the empty string, | 62 | is an empty string, |
| 60 | .Fn strstr | 63 | .Fa big |
| 61 | returns | 64 | is returned; |
| 62 | .Fa big ; | ||
| 63 | if | 65 | if |
| 64 | .Fa little | 66 | .Fa little |
| 65 | occurs nowhere in | 67 | occurs nowhere in |
| 66 | .Fa big , | 68 | .Fa big , |
| 67 | .Fn strstr | 69 | .Dv NULL |
| 68 | returns NULL; | 70 | is returned; |
| 69 | otherwise | 71 | otherwise a pointer to the first character of the first occurrence of |
| 70 | .Fn strstr | 72 | .Fa little |
| 71 | returns a pointer to the first character of the first occurrence of | 73 | is returned. |
| 72 | .Fa little . | ||
| 73 | .Sh SEE ALSO | 74 | .Sh SEE ALSO |
| 74 | .Xr index 3 , | ||
| 75 | .Xr memchr 3 , | 75 | .Xr memchr 3 , |
| 76 | .Xr rindex 3 , | ||
| 77 | .Xr strchr 3 , | 76 | .Xr strchr 3 , |
| 78 | .Xr strcspn 3 , | 77 | .Xr strcspn 3 , |
| 79 | .Xr strpbrk 3 , | 78 | .Xr strpbrk 3 , |
| 80 | .Xr strrchr 3 , | 79 | .Xr strrchr 3 , |
| 81 | .Xr strsep 3 , | 80 | .Xr strsep 3 , |
| 82 | .Xr strspn 3 , | 81 | .Xr strspn 3 , |
| 83 | .Xr strtok 3 | 82 | .Xr strtok 3 , |
| 83 | .Xr wcsstr 3 | ||
| 84 | .Sh STANDARDS | 84 | .Sh STANDARDS |
| 85 | The | 85 | The |
| 86 | .Fn strstr | 86 | .Fn strstr |
| 87 | function | 87 | function conforms to |
| 88 | conforms to | ||
| 89 | .St -ansiC . | 88 | .St -ansiC . |
| 89 | .Sh HISTORY | ||
| 90 | The | ||
| 91 | .Fn strstr | ||
| 92 | function first appeared in | ||
| 93 | .Bx 4.3 Reno . | ||
| 94 | The | ||
| 95 | .Fn strcasestr | ||
| 96 | function appeared in glibc 2.1, | ||
| 97 | was reimplemented for | ||
| 98 | .Fx 4.5 | ||
| 99 | and ported to | ||
| 100 | .Ox 3.8 . | ||
