xref: /freebsd/lib/libc/locale/wctomb.3 (revision 8b8109275c1a583e96171df08e3136151c02279e)
18b810927STim J. Robbins.\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved.
2bc0b3a18STim J. Robbins.\" Copyright (c) 1993
3bc0b3a18STim J. Robbins.\"	The Regents of the University of California.  All rights reserved.
4bc0b3a18STim J. Robbins.\"
5bc0b3a18STim J. Robbins.\" This code is derived from software contributed to Berkeley by
6bc0b3a18STim J. Robbins.\" Donn Seeley of BSDI.
7bc0b3a18STim J. Robbins.\"
8bc0b3a18STim J. Robbins.\" Redistribution and use in source and binary forms, with or without
9bc0b3a18STim J. Robbins.\" modification, are permitted provided that the following conditions
10bc0b3a18STim J. Robbins.\" are met:
11bc0b3a18STim J. Robbins.\" 1. Redistributions of source code must retain the above copyright
12bc0b3a18STim J. Robbins.\"    notice, this list of conditions and the following disclaimer.
13bc0b3a18STim J. Robbins.\" 2. Redistributions in binary form must reproduce the above copyright
14bc0b3a18STim J. Robbins.\"    notice, this list of conditions and the following disclaimer in the
15bc0b3a18STim J. Robbins.\"    documentation and/or other materials provided with the distribution.
16bc0b3a18STim J. Robbins.\" 3. All advertising materials mentioning features or use of this software
17bc0b3a18STim J. Robbins.\"    must display the following acknowledgement:
18bc0b3a18STim J. Robbins.\"	This product includes software developed by the University of
19bc0b3a18STim J. Robbins.\"	California, Berkeley and its contributors.
20bc0b3a18STim J. Robbins.\" 4. Neither the name of the University nor the names of its contributors
21bc0b3a18STim J. Robbins.\"    may be used to endorse or promote products derived from this software
22bc0b3a18STim J. Robbins.\"    without specific prior written permission.
23bc0b3a18STim J. Robbins.\"
24bc0b3a18STim J. Robbins.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25bc0b3a18STim J. Robbins.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26bc0b3a18STim J. Robbins.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27bc0b3a18STim J. Robbins.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28bc0b3a18STim J. Robbins.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29bc0b3a18STim J. Robbins.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30bc0b3a18STim J. Robbins.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31bc0b3a18STim J. Robbins.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32bc0b3a18STim J. Robbins.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33bc0b3a18STim J. Robbins.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34bc0b3a18STim J. Robbins.\" SUCH DAMAGE.
35bc0b3a18STim J. Robbins.\"
36bc0b3a18STim J. Robbins.\" From @(#)multibyte.3	8.1 (Berkeley) 6/4/93
37bc0b3a18STim J. Robbins.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
38bc0b3a18STim J. Robbins.\" $FreeBSD$
39bc0b3a18STim J. Robbins.\"
408b810927STim J. Robbins.Dd April 8, 2004
41bc0b3a18STim J. Robbins.Dt WCTOMB 3
42bc0b3a18STim J. Robbins.Os
43bc0b3a18STim J. Robbins.Sh NAME
44bc0b3a18STim J. Robbins.Nm wctomb
45bc0b3a18STim J. Robbins.Nd convert a wide-character code to a character
46bc0b3a18STim J. Robbins.Sh LIBRARY
47bc0b3a18STim J. Robbins.Lb libc
48bc0b3a18STim J. Robbins.Sh SYNOPSIS
49bc0b3a18STim J. Robbins.In stdlib.h
50bc0b3a18STim J. Robbins.Ft int
51bc0b3a18STim J. Robbins.Fn wctomb "char *mbchar" "wchar_t wchar"
52bc0b3a18STim J. Robbins.Sh DESCRIPTION
53bc0b3a18STim J. RobbinsThe
54bc0b3a18STim J. Robbins.Fn wctomb
55bc0b3a18STim J. Robbinsfunction converts a wide character
56bc0b3a18STim J. Robbins.Fa wchar
57bc0b3a18STim J. Robbinsinto a multibyte character and stores
58bc0b3a18STim J. Robbinsthe result in
59bc0b3a18STim J. Robbins.Fa mbchar .
60bc0b3a18STim J. RobbinsThe object pointed to by
61bc0b3a18STim J. Robbins.Fa mbchar
62bc0b3a18STim J. Robbinsmust be large enough to accommodate the multibyte character, which
63bc0b3a18STim J. Robbinsmay be up to
64bc0b3a18STim J. Robbins.Dv MB_LEN_MAX
65bc0b3a18STim J. Robbinsbytes.
66bc0b3a18STim J. Robbins.Pp
67bc0b3a18STim J. RobbinsA call with a null
68bc0b3a18STim J. Robbins.Fa mbchar
69bc0b3a18STim J. Robbinspointer returns nonzero if the current locale requires shift states,
70bc0b3a18STim J. Robbinszero otherwise;
71bc0b3a18STim J. Robbinsif shift states are required, the shift state is reset to the initial state.
72bc0b3a18STim J. Robbins.Sh RETURN VALUES
73bc0b3a18STim J. RobbinsIf
74bc0b3a18STim J. Robbins.Fa mbchar
75bc0b3a18STim J. Robbinsis
76bc0b3a18STim J. Robbins.Dv NULL ,
77bc0b3a18STim J. Robbinsthe
78bc0b3a18STim J. Robbins.Fn wctomb
79bc0b3a18STim J. Robbinsfunction returns nonzero if shift states are supported,
80bc0b3a18STim J. Robbinszero otherwise.
81bc0b3a18STim J. RobbinsIf
82bc0b3a18STim J. Robbins.Fa mbchar
83bc0b3a18STim J. Robbinsis valid,
84bc0b3a18STim J. Robbins.Fn wctomb
85bc0b3a18STim J. Robbinsreturns
86bc0b3a18STim J. Robbinsthe number of bytes processed in
87bc0b3a18STim J. Robbins.Fa mbchar ,
88bc0b3a18STim J. Robbinsor \-1 if no multibyte character
89bc0b3a18STim J. Robbinscould be recognized or converted.
908b810927STim J. RobbinsIn this case,
918b810927STim J. Robbins.Fn wctomb Ns No 's
928b810927STim J. Robbinsinternal conversion state is undefined.
93bc0b3a18STim J. Robbins.Sh ERRORS
94bc0b3a18STim J. RobbinsThe
95bc0b3a18STim J. Robbins.Fn wctomb
96bc0b3a18STim J. Robbinsfunction will fail if:
97bc0b3a18STim J. Robbins.Bl -tag -width Er
98bc0b3a18STim J. Robbins.It Bq Er EILSEQ
99bc0b3a18STim J. RobbinsAn invalid multibyte sequence was detected.
1008b810927STim J. Robbins.It Bq Er EINVAL
1018b810927STim J. RobbinsThe internal conversion state is invalid.
102bc0b3a18STim J. Robbins.El
103bc0b3a18STim J. Robbins.Sh SEE ALSO
104bc0b3a18STim J. Robbins.Xr mbtowc 3 ,
105bc0b3a18STim J. Robbins.Xr wcrtomb 3 ,
106bc0b3a18STim J. Robbins.Xr wcstombs 3 ,
107bc0b3a18STim J. Robbins.Xr wctob 3
108bc0b3a18STim J. Robbins.Sh STANDARDS
109bc0b3a18STim J. RobbinsThe
110bc0b3a18STim J. Robbins.Fn wctomb
111bc0b3a18STim J. Robbinsfunction conforms to
1128b810927STim J. Robbins.St -isoC-99 .
113