Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jun 2012 12:52:15 +0000 (UTC)
From:      Isabell Long <issyl0@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r237393 - head/lib/libc/string
Message-ID:  <201206211252.q5LCqF8U013782@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: issyl0 (doc committer)
Date: Thu Jun 21 12:52:15 2012
New Revision: 237393
URL: http://svn.freebsd.org/changeset/base/237393

Log:
  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

Modified:
  head/lib/libc/string/strcasecmp.3
  head/lib/libc/string/strcoll.3
  head/lib/libc/string/strstr.3
  head/lib/libc/string/strxfrm.3

Modified: head/lib/libc/string/strcasecmp.3
==============================================================================
--- head/lib/libc/string/strcasecmp.3	Thu Jun 21 12:51:24 2012	(r237392)
+++ head/lib/libc/string/strcasecmp.3	Thu Jun 21 12:52:15 2012	(r237393)
@@ -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 ch
 .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 ,

Modified: head/lib/libc/string/strcoll.3
==============================================================================
--- head/lib/libc/string/strcoll.3	Thu Jun 21 12:51:24 2012	(r237392)
+++ head/lib/libc/string/strcoll.3	Thu Jun 21 12:52:15 2012	(r237393)
@@ -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 
 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 .

Modified: head/lib/libc/string/strstr.3
==============================================================================
--- head/lib/libc/string/strstr.3	Thu Jun 21 12:51:24 2012	(r237392)
+++ head/lib/libc/string/strstr.3	Thu Jun 21 12:52:15 2012	(r237393)
@@ -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

Modified: head/lib/libc/string/strxfrm.3
==============================================================================
--- head/lib/libc/string/strxfrm.3	Thu Jun 21 12:51:24 2012	(r237392)
+++ head/lib/libc/string/strxfrm.3	Thu Jun 21 12:52:15 2012	(r237393)
@@ -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 .



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206211252.q5LCqF8U013782>