]>
Commit | Line | Data |
---|---|---|
224c7076 A |
1 | .\" Copyright (c) 2002-2004 Tim J. Robbins |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" Redistribution and use in source and binary forms, with or without | |
5 | .\" modification, are permitted provided that the following conditions | |
6 | .\" are met: | |
7 | .\" 1. Redistributions of source code must retain the above copyright | |
8 | .\" notice, this list of conditions and the following disclaimer. | |
9 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer in the | |
11 | .\" documentation and/or other materials provided with the distribution. | |
12 | .\" | |
13 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
14 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
15 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
16 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
17 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
18 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
19 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
20 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
21 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
22 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
23 | .\" SUCH DAMAGE. | |
24 | .\" | |
25 | .\" $FreeBSD: src/lib/libc/locale/wcrtomb.3,v 1.4 2004/04/08 09:59:02 tjr Exp $ | |
26 | .\" | |
27 | .Dd April 8, 2004 | |
28 | .Dt WCRTOMB 3 | |
29 | .Os | |
30 | .Sh NAME | |
31 | .Nm wcrtomb , | |
32 | .Nm wcrtomb_l | |
33 | .Nd "convert a wide-character code to a character (restartable)" | |
34 | .Sh LIBRARY | |
35 | .Lb libc | |
36 | .Sh SYNOPSIS | |
37 | .In wchar.h | |
38 | .Ft size_t | |
39 | .Fo wcrtomb | |
40 | .Fa "char *restrict s" | |
41 | .Fa "wchar_t wc" | |
42 | .Fa "mbstate_t *restrict ps" | |
43 | .Fc | |
44 | .In wchar.h | |
45 | .In xlocale.h | |
46 | .Ft size_t | |
47 | .Fo wcrtomb_l | |
48 | .Fa "char *restrict s" | |
49 | .Fa "wchar_t wc" | |
50 | .Fa "mbstate_t *restrict ps" | |
51 | .Fa "locale_t loc" | |
52 | .Fc | |
53 | .Sh DESCRIPTION | |
54 | The | |
55 | .Fn wcrtomb | |
56 | function stores a multibyte sequence representing the | |
57 | wide character | |
58 | .Fa wc , | |
59 | including any necessary shift sequences, to the | |
60 | character array | |
61 | .Fa s . | |
62 | A maximum of | |
63 | .Dv MB_CUR_MAX | |
64 | bytes will be stored. | |
65 | .Pp | |
66 | If | |
67 | .Fa s | |
68 | is | |
69 | .Dv NULL , | |
70 | .Fn wcrtomb | |
71 | behaves as if | |
72 | .Fa s | |
73 | pointed to an internal buffer and | |
74 | .Fa wc | |
75 | were a null wide character (L'\e0'). | |
76 | .Pp | |
77 | The | |
78 | .Ft mbstate_t | |
79 | argument, | |
80 | .Fa ps , | |
81 | is used to keep track of the shift state. | |
82 | If it is | |
83 | .Dv NULL , | |
84 | .Fn wcrtomb | |
85 | uses an internal, static | |
86 | .Vt mbstate_t | |
87 | object, which is initialized to the initial conversion state | |
88 | at program startup. | |
89 | .Pp | |
90 | While the | |
91 | .Fn wcrtomb | |
92 | function uses the current locale, the | |
93 | .Fn wcrtomb_l | |
94 | function may be passed a locale directly. See | |
95 | .Xr xlocale 3 | |
96 | for more information. | |
97 | .Sh RETURN VALUES | |
98 | The | |
99 | .Fn wcrtomb | |
100 | functions returns the length (in bytes) of the multibyte sequence | |
101 | needed to represent | |
102 | .Fa wc , | |
103 | or | |
104 | .Po Vt size_t Pc Ns \-1 | |
105 | if | |
106 | .Fa wc | |
107 | is not a valid wide character code. | |
108 | .Sh ERRORS | |
109 | The | |
110 | .Fn wcrtomb | |
111 | function will fail if: | |
112 | .Bl -tag -width Er | |
113 | .It Bq Er EILSEQ | |
114 | An invalid wide character code was specified. | |
115 | .It Bq Er EINVAL | |
116 | The conversion state is invalid. | |
117 | .El | |
118 | .Sh SEE ALSO | |
119 | .Xr mbrtowc 3 , | |
120 | .Xr multibyte 3 , | |
121 | .Xr setlocale 3 , | |
122 | .Xr wctomb 3 , | |
123 | .Xr xlocale 3 | |
124 | .Sh STANDARDS | |
125 | The | |
126 | .Fn wcrtomb | |
127 | function conforms to | |
128 | .St -isoC-99 . |