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
This commit is contained in:
Isabell Long 2012-06-21 12:52:15 +00:00
parent 9f4ab62e92
commit db356f0370
4 changed files with 54 additions and 7 deletions

View File

@ -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 ,

View File

@ -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 .

View File

@ -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

View File

@ -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 .