1 .\" $NetBSD: mbtowc.3,v 1.8 2006/10/16 09:10:29 wiz Exp $
3 .\" Copyright (c)2002 Citrus Project,
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" ----------------------------------------------------------------------
33 .Nd converts a multibyte character to a wide character
34 .\" ----------------------------------------------------------------------
37 .\" ----------------------------------------------------------------------
41 .Fn mbtowc "wchar_t * restrict pwc" "const char * restrict s" "size_t n"
44 usually converts the multibyte character pointed to by
46 to a wide character, and stores it in the wchar_t object pointed to by
54 points to a valid character.
55 This function may inspect at most n bytes of the array beginning from
58 In state-dependent encodings,
60 may point to the special sequence bytes to change the shift-state.
61 Although such sequence bytes correspond to no individual
64 changes its own state by the sequence bytes and treats them
65 as if they are a part of the subsequence multibyte character.
73 need to form an entire multibyte character.
74 Otherwise, this function causes an error.
76 Calling any other functions in
78 never changes the internal state of
84 category of the current locale.
87 call causes the internal state of this function to be indeterminate.
93 category of the current locale.
95 There are special cases:
96 .Bl -tag -width 012345678901
99 initializes its own internal state to an initial state, and
100 determines whether the current encoding is state-dependent.
101 This function returns 0 if the encoding is state-independent,
105 is completely ignored.
108 executes the conversion as if
110 is non-NULL, but a result of the conversion is discarded.
115 bytes of the array pointed to by
117 never form a complete character.
122 .\" ----------------------------------------------------------------------
127 .Bl -tag -width 012345678901
133 Number of bytes for the valid multibyte character pointed to by
135 There are no cases that the value returned is greater than
141 points to an invalid or an incomplete multibyte character.
146 to indicate the error.
155 .Bl -tag -width 0123456789
157 The current encoding is state-independent.
159 The current encoding is state-dependent.
161 .\" ----------------------------------------------------------------------
164 may cause an error in the following case:
168 points to an invalid or incomplete multibyte character.
170 .\" ----------------------------------------------------------------------
175 .\" ----------------------------------------------------------------------
181 The restrict qualifier is added at