summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorissyl0 <issyl0@FreeBSD.org>2012-06-21 12:52:15 +0000
committerissyl0 <issyl0@FreeBSD.org>2012-06-21 12:52:15 +0000
commit0482bcac1d40f2aa024459cbaa097ac522a8a4cf (patch)
tree1e7e2c9ec03bcbd6144c66cee00f0a7e6f48c2c6
parent43d53ca7086c12dc35ef46468c7c0d3678761788 (diff)
downloadFreeBSD-src-0482bcac1d40f2aa024459cbaa097ac522a8a4cf.zip
FreeBSD-src-0482bcac1d40f2aa024459cbaa097ac522a8a4cf.tar.gz
Add more locale-specific functions to the relevant man pages:
- libc/string/strcoll.3 - libc/string/strstr.3 - libc/string/strxfrm.3 - libc/string/strcasecmp.3 Reviewed by: theraven, gabor Approved by: gabor (mentor) MFC after: 5 days
-rw-r--r--lib/libc/string/strcasecmp.323
-rw-r--r--lib/libc/string/strcoll.314
-rw-r--r--lib/libc/string/strstr.310
-rw-r--r--lib/libc/string/strxfrm.314
4 files changed, 54 insertions, 7 deletions
diff --git a/lib/libc/string/strcasecmp.3 b/lib/libc/string/strcasecmp.3
index 2b2ef3e..760b9d4 100644
--- a/lib/libc/string/strcasecmp.3
+++ b/lib/libc/string/strcasecmp.3
@@ -45,6 +45,12 @@
.Fn strcasecmp "const char *s1" "const char *s2"
.Ft int
.Fn strncasecmp "const char *s1" "const char *s2" "size_t len"
+.In string.h
+.In xlocale.h
+.Ft int
+.Fn strcasecmp_l "const char *s1" "const char *s2" "locale_t loc"
+.Ft int
+.Fn strncasecmp_l "const char *s1" "const char *s2" "site_t len" "locale_t loc"
.Sh DESCRIPTION
The
.Fn strcasecmp
@@ -58,16 +64,22 @@ and
.Pp
The
.Fn strncasecmp
-compares at most
+function compares at most
.Fa len
characters.
-.Sh RETURN VALUES
The
+.Fn strcasecmp_l
+and
+.Fn strncasecmp_l
+functions do the same as their non-locale versions above, but take an
+explicit locale rather than using the current locale.
+.Sh RETURN VALUES
+The functions
.Fn strcasecmp
and
.Fn strncasecmp
return an integer greater than, equal to, or less than 0,
-according as
+depending on whether
.Fa s1
is lexicographically greater than, equal to, or less than
.Fa s2
@@ -77,6 +89,11 @@ The comparison is done using unsigned characters, so that
.Sq Li \e200
is greater than
.Ql \e0 .
+The functions
+.Fn strcasecmp_l
+and
+.Fn strncasecmp_l
+do the same but take explicit locales.
.Sh SEE ALSO
.Xr bcmp 3 ,
.Xr memcmp 3 ,
diff --git a/lib/libc/string/strcoll.3 b/lib/libc/string/strcoll.3
index bb8b13f..20f1888 100644
--- a/lib/libc/string/strcoll.3
+++ b/lib/libc/string/strcoll.3
@@ -44,6 +44,8 @@
.In string.h
.Ft int
.Fn strcoll "const char *s1" "const char *s2"
+.Ft int
+.Fn strcoll_l "const char *s1" "const char *s2" "locale_t loc"
.Sh DESCRIPTION
The
.Fn strcoll
@@ -54,7 +56,7 @@ and
.Fa s2
according to the current locale collation
and returns an integer greater than, equal to, or less than 0,
-according as
+depending on whether
.Fa s1
is greater than, equal to, or less than
.Fa s2 .
@@ -62,6 +64,9 @@ If information about the current locale collation is not available,
the value of
.Fn strcmp s1 s2
is returned.
+The
+.Fn strcoll_l
+function uses an explicit locale argument rather than the system locale.
.Sh SEE ALSO
.Xr setlocale 3 ,
.Xr strcmp 3 ,
@@ -70,6 +75,9 @@ is returned.
.Sh STANDARDS
The
.Fn strcoll
-function
-conforms to
+function conforms to
.St -isoC .
+The
+.Fn strcoll_l
+function conforms to
+.St -p1003.1-2008 .
diff --git a/lib/libc/string/strstr.3 b/lib/libc/string/strstr.3
index 74ebdff..376def6 100644
--- a/lib/libc/string/strstr.3
+++ b/lib/libc/string/strstr.3
@@ -49,6 +49,10 @@
.Fn strcasestr "const char *big" "const char *little"
.Ft char *
.Fn strnstr "const char *big" "const char *little" "size_t len"
+.In string.h
+.In xlocale.h
+.Ft char *
+.Fn strcasestr_l "const char *big" "const char *little" "locale_t loc"
.Sh DESCRIPTION
The
.Fn strstr
@@ -65,6 +69,12 @@ function is similar to
but ignores the case of both strings.
.Pp
The
+.Fn strcasestr_l
+function does the same as
+.Fn strcasestr
+but takes an explicit locale rather than using the current locale.
+.Pp
+The
.Fn strnstr
function
locates the first occurrence of the null-terminated string
diff --git a/lib/libc/string/strxfrm.3 b/lib/libc/string/strxfrm.3
index 5f33763..da7c82a 100644
--- a/lib/libc/string/strxfrm.3
+++ b/lib/libc/string/strxfrm.3
@@ -44,6 +44,8 @@
.In string.h
.Ft size_t
.Fn strxfrm "char * restrict dst" "const char * restrict src" "size_t n"
+.Ft size_t
+.Fn strxfrm_l "char * restrict dst" "const char *restrict src" "size_t n" "locale_t loc"
.Sh DESCRIPTION
The
.Fn strxfrm
@@ -73,10 +75,16 @@ after
is equal to comparing
two original strings with
.Fn strcoll .
+.Pp
+.Fn strxfrm_l
+does the same, however takes an explicit locale rather than the global
+locale.
.Sh RETURN VALUES
Upon successful completion,
.Fn strxfrm
-returns the length of the transformed string not including
+and
+.Fn strxfrm_l
+return the length of the transformed string not including
the terminating null character.
If this value is
.Fa n
@@ -94,3 +102,7 @@ The
function
conforms to
.St -isoC .
+The
+.Fn strxfrm_l
+function conforms to
+.St -p1003.1-2008 .
OpenPOWER on IntegriCloud