diff options
author | schwarze <> | 2017-09-05 03:16:14 +0000 |
---|---|---|
committer | schwarze <> | 2017-09-05 03:16:14 +0000 |
commit | f63c4fd91b8483c7d4364046fd6ef2d2679dd63a (patch) | |
tree | d7f851bfa426cf869a3a3aec05ffba386b6f2ce5 /src/lib/libc/string/strcoll.3 | |
parent | c1d0fec9b838e4df93e396d54f1e4b9a41f7401a (diff) | |
download | openbsd-f63c4fd91b8483c7d4364046fd6ef2d2679dd63a.tar.gz openbsd-f63c4fd91b8483c7d4364046fd6ef2d2679dd63a.tar.bz2 openbsd-f63c4fd91b8483c7d4364046fd6ef2d2679dd63a.zip |
New POSIX xlocale implementation written from scratch.libressl-v2.6.1
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 'src/lib/libc/string/strcoll.3')
-rw-r--r-- | src/lib/libc/string/strcoll.3 | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/src/lib/libc/string/strcoll.3 b/src/lib/libc/string/strcoll.3 index d421200b62..4ba1f22677 100644 --- a/src/lib/libc/string/strcoll.3 +++ b/src/lib/libc/string/strcoll.3 | |||
@@ -1,4 +1,7 @@ | |||
1 | .\" $OpenBSD: strcoll.3,v 1.10 2017/09/05 03:16:13 schwarze Exp $ | ||
2 | .\" | ||
1 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. | 3 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. |
4 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | ||
2 | .\" All rights reserved. | 5 | .\" All rights reserved. |
3 | .\" | 6 | .\" |
4 | .\" This code is derived from software contributed to Berkeley by | 7 | .\" This code is derived from software contributed to Berkeley by |
@@ -29,45 +32,69 @@ | |||
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 32 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
30 | .\" SUCH DAMAGE. | 33 | .\" SUCH DAMAGE. |
31 | .\" | 34 | .\" |
32 | .\" $OpenBSD: strcoll.3,v 1.9 2013/06/05 03:39:23 tedu Exp $ | 35 | .Dd $Mdocdate: September 5 2017 $ |
33 | .\" | ||
34 | .Dd $Mdocdate: June 5 2013 $ | ||
35 | .Dt STRCOLL 3 | 36 | .Dt STRCOLL 3 |
36 | .Os | 37 | .Os |
37 | .Sh NAME | 38 | .Sh NAME |
38 | .Nm strcoll | 39 | .Nm strcoll , |
40 | .Nm strcoll_l | ||
39 | .Nd compare strings according to current collation | 41 | .Nd compare strings according to current collation |
40 | .Sh SYNOPSIS | 42 | .Sh SYNOPSIS |
41 | .In string.h | 43 | .In string.h |
42 | .Ft int | 44 | .Ft int |
43 | .Fn strcoll "const char *s1" "const char *s2" | 45 | .Fn strcoll "const char *s1" "const char *s2" |
46 | .Ft int | ||
47 | .Fn strcoll_l "const char *s1" "const char *s2" "locale_t locale" | ||
44 | .Sh DESCRIPTION | 48 | .Sh DESCRIPTION |
45 | The | 49 | The |
46 | .Fn strcoll | 50 | .Fn strcoll |
47 | function lexicographically compares the NUL-terminated strings | 51 | and |
52 | .Fn strcoll_l | ||
53 | functions lexicographically compare the NUL-terminated strings | ||
48 | .Fa s1 | 54 | .Fa s1 |
49 | and | 55 | and |
50 | .Fa s2 | 56 | .Fa s2 |
51 | according to the current locale collation | 57 | according to the current locale collation |
52 | and returns an integer greater than, equal to, or less than 0, | 58 | and return an integer greater than, equal to, or less than 0, |
53 | according to whether | 59 | according to whether |
54 | .Fa s1 | 60 | .Fa s1 |
55 | is greater than, equal to, or less than | 61 | is greater than, equal to, or less than |
56 | .Fa s2 . | 62 | .Fa s2 . |
63 | .Pp | ||
64 | On | ||
65 | .Ox , | ||
66 | they have the same effect as | ||
67 | .Xr strcmp 3 , | ||
68 | and the global locale, the thread-specific locale, and the | ||
69 | .Fa locale | ||
70 | argument are ignored. | ||
71 | .Sh ENVIRONMENT | ||
72 | On other operating systems, the behaviour of | ||
73 | .Fn strcoll | ||
74 | may depend on the | ||
75 | .Dv LC_CTYPE | ||
76 | .Xr locale 1 . | ||
57 | .Sh SEE ALSO | 77 | .Sh SEE ALSO |
58 | .Xr bcmp 3 , | 78 | .Xr newlocale 3 , |
59 | .Xr memcmp 3 , | ||
60 | .Xr setlocale 3 , | 79 | .Xr setlocale 3 , |
61 | .Xr strcasecmp 3 , | ||
62 | .Xr strcmp 3 , | 80 | .Xr strcmp 3 , |
63 | .Xr strxfrm 3 | 81 | .Xr strxfrm 3 , |
82 | .Xr wcscoll 3 | ||
64 | .Sh STANDARDS | 83 | .Sh STANDARDS |
65 | The | 84 | The |
66 | .Fn strcoll | 85 | .Fn strcoll |
67 | function conforms to | 86 | function conforms to |
68 | .St -ansiC . | 87 | .St -ansiC , |
88 | and | ||
89 | .Fn strcoll_l | ||
90 | to | ||
91 | .St -p1003.1-2008 . | ||
69 | .Sh HISTORY | 92 | .Sh HISTORY |
70 | The | 93 | The |
71 | .Fn strcoll | 94 | .Fn strcoll |
72 | function first appeared in | 95 | function has been available since |
73 | .Bx 4.3 Reno . | 96 | .Bx 4.3 Reno , |
97 | and | ||
98 | .Fn strcoll_l | ||
99 | since | ||
100 | .Ox 6.2 . | ||