]> git.saurik.com Git - apple/libc.git/blobdiff - string/strstr.3
Libc-498.1.1.tar.gz
[apple/libc.git] / string / strstr.3
index 433f26cb55376f795f328c88e581b4fe9b7c5526..1654b96adb8777a95fb27ff99e59da5716c6d48d 100644 (file)
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)strstr.3   8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/strstr.3,v 1.11 2001/10/11 15:49:06 mike Exp $
+.\" $FreeBSD: src/lib/libc/string/strstr.3,v 1.12 2001/11/20 14:11:07 ru Exp $
 .\"
 .Dd October 11, 2001
 .Dt STRSTR 3
 .Os
 .Sh NAME
-.Nm strstr , strcasestr , strnstr
+.Nm strcasestr ,
+.Nm strcasestr_l ,
+.Nm strnstr ,
+.Nm strstr
 .Nd locate a substring in a string
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In string.h
 .Ft char *
-.Fn strstr "const char *big" "const char *little"
+.Fo strcasestr
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
 .Ft char *
-.Fn strcasestr "const char *big" "const char *little"
+.Fo strnstr
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fa "size_t n"
+.Fc
 .Ft char *
-.Fn strnstr "const char *big" "const char *little" "size_t len"
+.Fo strstr
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fc
+.In string.h
+.In xlocale.h
+.Ft char *
+.Fo strcasestr_l
+.Fa "const char *s1"
+.Fa "const char *s2"
+.Fa "locale_t loc"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn strstr
 function
 locates the first occurrence of the null-terminated string
-.Fa little
+.Fa s2
 in the null-terminated string
-.Fa big .
+.Fa s1 .
 .Pp
 The
 .Fn strcasestr
@@ -72,11 +93,11 @@ The
 .Fn strnstr
 function
 locates the first occurrence of the null-terminated string
-.Fa little
+.Fa s2
 in the string
-.Fa big ,
+.Fa s1 ,
 where not more than
-.Fa len
+.Fa n
 characters are searched.
 Characters that appear after a
 .Ql \e0
@@ -85,26 +106,35 @@ Since the
 .Fn strnstr
 function is a
 .Fx
-specific API, it should only be used when portablility is not a concern.
+specific API, it should only be used when portability is not a concern.
+.Pp
+While the
+.Fn strcasestr
+function uses the current locale, the
+.Fn strcasestr_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
 .Sh RETURN VALUES
 If
-.Fa little
+.Fa s2
 is an empty string,
-.Fa big
+.Fa s1
 is returned;
 if
-.Fa little
+.Fa s2
 occurs nowhere in
-.Fa big ,
-NULL is returned;
+.Fa s1 ,
+.Dv NULL
+is returned;
 otherwise a pointer to the first character of the first occurrence of
-.Fa little
+.Fa s2
 is returned.
 .Sh EXAMPLES
 The following sets the pointer
 .Va ptr
 to the
-.Dq Li Bar Baz
+.Qq Li Bar Baz
 portion of
 .Va largestring :
 .Bd -literal -offset indent
@@ -117,7 +147,9 @@ ptr = strstr(largestring, smallstring);
 .Pp
 The following sets the pointer
 .Va ptr
-to NULL, because only the first 4 characters of 
+to
+.Dv NULL ,
+because only the first 4 characters of
 .Va largestring
 are searched:
 .Bd -literal -offset indent
@@ -135,7 +167,8 @@ ptr = strnstr(largestring, smallstring, 4);
 .Xr strrchr 3 ,
 .Xr strsep 3 ,
 .Xr strspn 3 ,
-.Xr strtok 3
+.Xr strtok 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn strstr