From f63c4fd91b8483c7d4364046fd6ef2d2679dd63a Mon Sep 17 00:00:00 2001 From: schwarze <> Date: Tue, 5 Sep 2017 03:16:14 +0000 Subject: 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. --- src/lib/libc/string/wcscasecmp.3 | 76 ++++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 18 deletions(-) (limited to 'src/lib/libc/string/wcscasecmp.3') diff --git a/src/lib/libc/string/wcscasecmp.3 b/src/lib/libc/string/wcscasecmp.3 index daf397aece..9db4a829b9 100644 --- a/src/lib/libc/string/wcscasecmp.3 +++ b/src/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 .\" .\" 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 -- cgit v1.2.3-55-g6feb