xref: /freebsd-src/lib/libc/string/wcsxfrm.3 (revision dc36d6f9bb1753f3808552f3afd30eda9a7b206a)
1fd4f1dd9STim J. Robbins.\" Copyright (c) 1990, 1991, 1993
2fd4f1dd9STim J. Robbins.\"	The Regents of the University of California.  All rights reserved.
3fd4f1dd9STim J. Robbins.\"
4fd4f1dd9STim J. Robbins.\" This code is derived from software contributed to Berkeley by
5fd4f1dd9STim J. Robbins.\" Chris Torek and the American National Standards Committee X3,
6fd4f1dd9STim J. Robbins.\" on Information Processing Systems.
7fd4f1dd9STim J. Robbins.\"
8fd4f1dd9STim J. Robbins.\" Redistribution and use in source and binary forms, with or without
9fd4f1dd9STim J. Robbins.\" modification, are permitted provided that the following conditions
10fd4f1dd9STim J. Robbins.\" are met:
11fd4f1dd9STim J. Robbins.\" 1. Redistributions of source code must retain the above copyright
12fd4f1dd9STim J. Robbins.\"    notice, this list of conditions and the following disclaimer.
13fd4f1dd9STim J. Robbins.\" 2. Redistributions in binary form must reproduce the above copyright
14fd4f1dd9STim J. Robbins.\"    notice, this list of conditions and the following disclaimer in the
15fd4f1dd9STim J. Robbins.\"    documentation and/or other materials provided with the distribution.
16*3fb3b97cSEd Maste.\" 3. Neither the name of the University nor the names of its contributors
17fd4f1dd9STim J. Robbins.\"    may be used to endorse or promote products derived from this software
18fd4f1dd9STim J. Robbins.\"    without specific prior written permission.
19fd4f1dd9STim J. Robbins.\"
20fd4f1dd9STim J. Robbins.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21fd4f1dd9STim J. Robbins.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22fd4f1dd9STim J. Robbins.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23fd4f1dd9STim J. Robbins.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24fd4f1dd9STim J. Robbins.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25fd4f1dd9STim J. Robbins.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26fd4f1dd9STim J. Robbins.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27fd4f1dd9STim J. Robbins.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28fd4f1dd9STim J. Robbins.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29fd4f1dd9STim J. Robbins.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30fd4f1dd9STim J. Robbins.\" SUCH DAMAGE.
31fd4f1dd9STim J. Robbins.\" FreeBSD: src/lib/libc/string/strxfrm.3,v 1.16 2002/09/06 11:24:06 tjr Exp
32fd4f1dd9STim J. Robbins.\"
33fd4f1dd9STim J. Robbins.Dd October 4, 2002
34fd4f1dd9STim J. Robbins.Dt WCSXFRM 3
35fd4f1dd9STim J. Robbins.Os
36fd4f1dd9STim J. Robbins.Sh NAME
37fd4f1dd9STim J. Robbins.Nm wcsxfrm
38fd4f1dd9STim J. Robbins.Nd transform a wide string under locale
39fd4f1dd9STim J. Robbins.Sh LIBRARY
40fd4f1dd9STim J. Robbins.Lb libc
41fd4f1dd9STim J. Robbins.Sh SYNOPSIS
42fd4f1dd9STim J. Robbins.In wchar.h
43fd4f1dd9STim J. Robbins.Ft size_t
44fd4f1dd9STim J. Robbins.Fn wcsxfrm "wchar_t * restrict dst" "const wchar_t * restrict src" "size_t n"
45fd4f1dd9STim J. Robbins.Sh DESCRIPTION
46fd4f1dd9STim J. RobbinsThe
47fd4f1dd9STim J. Robbins.Fn wcsxfrm
48fd4f1dd9STim J. Robbinsfunction transforms a null-terminated wide character string pointed to by
49fd4f1dd9STim J. Robbins.Fa src
50fd4f1dd9STim J. Robbinsaccording to the current locale collation order
51fd4f1dd9STim J. Robbinsthen copies the transformed string
52fd4f1dd9STim J. Robbinsinto
53fd4f1dd9STim J. Robbins.Fa dst .
54fd4f1dd9STim J. RobbinsNo more than
55fd4f1dd9STim J. Robbins.Fa n
56fd4f1dd9STim J. Robbinswide characters are copied into
57fd4f1dd9STim J. Robbins.Fa dst ,
58fd4f1dd9STim J. Robbinsincluding the terminating null character added.
59fd4f1dd9STim J. RobbinsIf
60fd4f1dd9STim J. Robbins.Fa n
61fd4f1dd9STim J. Robbinsis set to 0
62fd4f1dd9STim J. Robbins(it helps to determine an actual size needed
63fd4f1dd9STim J. Robbinsfor transformation),
64fd4f1dd9STim J. Robbins.Fa dst
65fd779e01SRuslan Ermilovis permitted to be a
66fd779e01SRuslan Ermilov.Dv NULL
67fd779e01SRuslan Ermilovpointer.
68fd4f1dd9STim J. Robbins.Pp
69fd4f1dd9STim J. RobbinsComparing two strings using
70fd4f1dd9STim J. Robbins.Fn wcscmp
71fd4f1dd9STim J. Robbinsafter
72fd4f1dd9STim J. Robbins.Fn wcsxfrm
73fd4f1dd9STim J. Robbinsis equivalent to comparing
74fd4f1dd9STim J. Robbinstwo original strings with
75fd4f1dd9STim J. Robbins.Fn wcscoll .
76fd4f1dd9STim J. Robbins.Sh RETURN VALUES
77fd4f1dd9STim J. RobbinsUpon successful completion,
78fd4f1dd9STim J. Robbins.Fn wcsxfrm
79fd4f1dd9STim J. Robbinsreturns the length of the transformed string not including
80fd4f1dd9STim J. Robbinsthe terminating null character.
81fd4f1dd9STim J. RobbinsIf this value is
82fd4f1dd9STim J. Robbins.Fa n
83fd4f1dd9STim J. Robbinsor more, the contents of
84fd4f1dd9STim J. Robbins.Fa dst
85fd4f1dd9STim J. Robbinsare indeterminate.
86fd4f1dd9STim J. Robbins.Sh SEE ALSO
87fd4f1dd9STim J. Robbins.Xr setlocale 3 ,
88fd4f1dd9STim J. Robbins.Xr strxfrm 3 ,
89fd779e01SRuslan Ermilov.Xr wcscmp 3 ,
90fd779e01SRuslan Ermilov.Xr wcscoll 3
91fd4f1dd9STim J. Robbins.Sh STANDARDS
92fd4f1dd9STim J. RobbinsThe
93fd4f1dd9STim J. Robbins.Fn wcsxfrm
94fd4f1dd9STim J. Robbinsfunction
95fd4f1dd9STim J. Robbinsconforms to
96fd4f1dd9STim J. Robbins.St -isoC-99 .
97fd4f1dd9STim J. Robbins.Sh BUGS
98fd4f1dd9STim J. RobbinsThe current implementation of
99fd4f1dd9STim J. Robbins.Fn wcsxfrm
100fd4f1dd9STim J. Robbinsonly works in single-byte
101fd4f1dd9STim J. Robbins.Dv LC_CTYPE
102fd4f1dd9STim J. Robbinslocales, and falls back to using
103fd4f1dd9STim J. Robbins.Fn wcsncpy
104fd4f1dd9STim J. Robbinsin locales with extended character sets.
105fd4f1dd9STim J. Robbins.Pp
106fd4f1dd9STim J. RobbinsComparing two strings using
107fd4f1dd9STim J. Robbins.Fn wcscmp
108fd4f1dd9STim J. Robbinsafter
109fd4f1dd9STim J. Robbins.Fn wcsxfrm
110fd4f1dd9STim J. Robbinsis
111fd4f1dd9STim J. Robbins.Em not
112fd4f1dd9STim J. Robbinsalways equivalent to comparison with
113fd4f1dd9STim J. Robbins.Fn wcscoll ;
114fd4f1dd9STim J. Robbins.Fn wcsxfrm
115fd4f1dd9STim J. Robbinsonly stores information about primary collation weights into
116fd4f1dd9STim J. Robbins.Fa dst ,
117fd4f1dd9STim J. Robbinswhereas
118fd4f1dd9STim J. Robbins.Fn wcscoll
119fd4f1dd9STim J. Robbinscompares characters using both primary and secondary weights.
120