summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/wcscasecmp.3
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2017-09-05 03:16:13 +0000
committerschwarze <schwarze@openbsd.org>2017-09-05 03:16:13 +0000
commit3a628b46e7aaa520a6215eccabf31d313c2e7de0 (patch)
treec6543ac3a194244f09c381abe688fa69e6c8d49a /lib/libc/string/wcscasecmp.3
parentAdd additional errno values required by POSIX. (diff)
downloadwireguard-openbsd-3a628b46e7aaa520a6215eccabf31d313c2e7de0.tar.xz
wireguard-openbsd-3a628b46e7aaa520a6215eccabf31d313c2e7de0.zip
New POSIX xlocale implementation written from scratch.
Complete in the sense that all POSIX *locale(3) and *_l(3) functions are included, but in OpenBSD, we of course only really care about LC_CTYPE and we only support ASCII and UTF-8. With important help from kettenis@, guenther@, and jca@. Repeated testing in ports bulk builds by naddy@. Additional testing by jca@, sebastia@, dcoppa@, and others. OK kettenis@ dcoppa@, and guenther@ on an earlier version. Riding guenther@'s libc/librthread major bump.
Diffstat (limited to 'lib/libc/string/wcscasecmp.3')
-rw-r--r--lib/libc/string/wcscasecmp.376
1 files changed, 58 insertions, 18 deletions
diff --git a/lib/libc/string/wcscasecmp.3 b/lib/libc/string/wcscasecmp.3
index daf397aecea..9db4a829b90 100644
--- a/lib/libc/string/wcscasecmp.3
+++ b/lib/libc/string/wcscasecmp.3
@@ -1,7 +1,8 @@
-.\" $OpenBSD: wcscasecmp.3,v 1.4 2013/07/16 15:21:11 schwarze Exp $
+.\" $OpenBSD: wcscasecmp.3,v 1.5 2017/09/05 03:16:14 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
+.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Chris Torek.
@@ -31,25 +32,43 @@
.\"
.\" @(#)strcasecmp.3 8.1 (Berkeley) 6/9/93
.\"
-.Dd $Mdocdate: July 16 2013 $
+.Dd $Mdocdate: September 5 2017 $
.Dt WCSCASECMP 3
.Os
.Sh NAME
.Nm wcscasecmp ,
-.Nm wcsncasecmp
+.Nm wcscasecmp_l ,
+.Nm wcsncasecmp ,
+.Nm wcsncasecmp_l
.Nd compare wide strings, ignoring case
.Sh SYNOPSIS
.In wchar.h
.Ft int
-.Fn wcscasecmp "const wchar_t *s1" "const wchar_t *s2"
+.Fo wcscasecmp
+.Fa "const wchar_t *s1"
+.Fa "const wchar_t *s2"
+.Fc
.Ft int
-.Fn wcsncasecmp "const wchar_t *s1" "const wchar_t *s2" "size_t len"
+.Fo wcscasecmp_l
+.Fa "const wchar_t *s1"
+.Fa "const wchar_t *s2"
+.Fa "locale_t locale"
+.Fc
+.Ft int
+.Fo wcsncasecmp
+.Fa "const wchar_t *s1"
+.Fa "const wchar_t *s2"
+.Fa "size_t len"
+.Fc
+.Ft int
+.Fo wcsncasecmp_l
+.Fa "const wchar_t *s1"
+.Fa "const wchar_t *s2"
+.Fa "size_t len"
+.Fa "locale_t locale"
+.Fc
.Sh DESCRIPTION
-The
-.Fn wcscasecmp
-and
-.Fn wcsncasecmp
-functions compare the wide strings
+These functions compare the wide strings
.Fa s1
and
.Fa s2
@@ -61,28 +80,49 @@ is lexicographically greater than, equal to, or less than
after translation of each corresponding wide character to lower case.
The wide strings themselves are not modified.
.Pp
+For the translation to lower case,
+.Fn wcscasecmp
+and
+.Fn wcsncasecmp
+use the thread-specific locale as defined with
+.Xr uselocale 3 ,
+falling back to the global locale defined with
+.Xr setlocale 3 .
+.Fn wcscasecmp_l
+and
+.Fn wcsncasecmp_l
+use the
+.Fa locale
+argument instead.
+.Pp
.Fn wcsncasecmp
-compares at most
+and
+.Fn wcsncasecmp_l
+compare at most
.Fa len
wide characters.
.Sh SEE ALSO
+.Xr newlocale 3 ,
+.Xr setlocale 3 ,
.Xr strcasecmp 3 ,
.Xr wcscmp 3 ,
.Xr wmemcmp 3
.Sh STANDARDS
-The
-.Fn wcscasecmp
-and
-.Fn wcsncasecmp
-functions conform to
+These functions conform to
.St -p1003.1-2008 .
.Sh HISTORY
The
.Fn wcscasecmp
and
.Fn wcsncasecmp
-functions first appeared in
-.Ox 5.0 .
+functions have been available since
+.Ox 5.0 ,
+and
+.Fn wcscasecmp_l
+and
+.Fn wcsncasecmp_l
+since
+.Ox 6.2 .
.Sh AUTHORS
The
.Ox