1 .\" $NetBSD: wcrtomb.3,v 1.8 2006/10/16 08:42:16 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 wide character to a multibyte character (restartable)
34 .\" ----------------------------------------------------------------------
37 .\" ----------------------------------------------------------------------
41 .Fn wcrtomb "char * restrict s" "wchar_t wc" "mbstate_t * restrict ps"
42 .\" ----------------------------------------------------------------------
45 converts the wide character given by
47 to the corresponding multibyte character, and stores it in the array
53 This function will modify the first at most
55 bytes of the array pointed to by
62 category of the current locale.
64 These are the special cases:
65 .Bl -tag -width 012345678901
67 For state-dependent encodings,
69 stores a nul byte preceded by special byte sequence (if any)
70 to return to an initial state in the array pointed to by
72 and the state object pointed to by
74 also returns to an initial state.
79 into an initial state.
80 It is equivalent to the following call:
81 .Bd -literal -offset indent
82 wcrtomb(buf, L'\\0', ps);
93 uses its own internal state object to keep the conversion state,
96 mentioned in this manual page.
98 Calling any other functions in
100 never changes the internal
103 which is initialized at startup time of the program.
105 .\" ----------------------------------------------------------------------
109 .Bl -tag -width 012345678901
111 The number of bytes (including any shift sequences)
112 which are stored in the array.
115 is not a valid wide character.
120 to indicate the error.
122 .\" ----------------------------------------------------------------------
125 may cause an error in the following case:
129 is not a valid wide character.
132 points to an invalid or uninitialized mbstate_t object.
134 .\" ----------------------------------------------------------------------
138 .\" ----------------------------------------------------------------------
144 The restrict qualifier is added at