xref: /freebsd/lib/libc/locale/mbsrtowcs.3 (revision 279062fae149e105dae7c28b638d49ba5715725d)
1e92a3d83STim J. Robbins.\" Copyright (c) 2002 Tim J. Robbins
2e92a3d83STim J. Robbins.\" All rights reserved.
3e92a3d83STim J. Robbins.\"
4e92a3d83STim J. Robbins.\" Redistribution and use in source and binary forms, with or without
5e92a3d83STim J. Robbins.\" modification, are permitted provided that the following conditions
6e92a3d83STim J. Robbins.\" are met:
7e92a3d83STim J. Robbins.\" 1. Redistributions of source code must retain the above copyright
8e92a3d83STim J. Robbins.\"    notice, this list of conditions and the following disclaimer.
9e92a3d83STim J. Robbins.\" 2. Redistributions in binary form must reproduce the above copyright
10e92a3d83STim J. Robbins.\"    notice, this list of conditions and the following disclaimer in the
11e92a3d83STim J. Robbins.\"    documentation and/or other materials provided with the distribution.
12e92a3d83STim J. Robbins.\"
13e92a3d83STim J. Robbins.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14e92a3d83STim J. Robbins.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15e92a3d83STim J. Robbins.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16e92a3d83STim J. Robbins.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17e92a3d83STim J. Robbins.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18e92a3d83STim J. Robbins.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19e92a3d83STim J. Robbins.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20e92a3d83STim J. Robbins.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21e92a3d83STim J. Robbins.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22e92a3d83STim J. Robbins.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23e92a3d83STim J. Robbins.\" SUCH DAMAGE.
24e92a3d83STim J. Robbins.\"
25e92a3d83STim J. Robbins.\" $FreeBSD$
26e92a3d83STim J. Robbins.Dd August 16, 2002
27e92a3d83STim J. Robbins.Dt MBSRTOWCS 3
28e92a3d83STim J. Robbins.Os
29e92a3d83STim J. Robbins.Sh NAME
30e92a3d83STim J. Robbins.Nm mbsrtowcs
31e92a3d83STim J. Robbins.Nd "convert a character string to a wide-character string (restartable)"
32e92a3d83STim J. Robbins.Sh LIBRARY
33e92a3d83STim J. Robbins.Lb libc
34e92a3d83STim J. Robbins.Sh SYNOPSIS
35e92a3d83STim J. Robbins.In wchar.h
36e92a3d83STim J. Robbins.Ft size_t
37279062faSRuslan Ermilov.Fo mbsrtowcs
38279062faSRuslan Ermilov.Fa "wchar_t * restrict dst" "const char ** restrict src" "size_t len"
39279062faSRuslan Ermilov.Fa "mbstate_t * restrict ps"
40279062faSRuslan Ermilov.Fc
41e92a3d83STim J. Robbins.Sh DESCRIPTION
42e92a3d83STim J. RobbinsThe
43e92a3d83STim J. Robbins.Fn mbsrtowcs
44e92a3d83STim J. Robbinsfunction converts a sequence of multibyte characters pointed to indirectly by
45e92a3d83STim J. Robbins.Fa src
46e92a3d83STim J. Robbinsinto a sequence of corresponding wide characters and stores at most
47e92a3d83STim J. Robbins.Fa len
48e92a3d83STim J. Robbinsof them in the
49279062faSRuslan Ermilov.Vt wchar_t
50e92a3d83STim J. Robbinsarray pointed to by
51e92a3d83STim J. Robbins.Fa dst ,
52279062faSRuslan Ermilovuntil it encounters a terminating null character
53279062faSRuslan Ermilov.Pq Li '\e0' .
54e92a3d83STim J. Robbins.Pp
55e92a3d83STim J. RobbinsIf
56e92a3d83STim J. Robbins.Fa dst
57e92a3d83STim J. Robbinsis
58e92a3d83STim J. Robbins.Dv NULL ,
59e92a3d83STim J. Robbinsno characters are stored.
60e92a3d83STim J. Robbins.Pp
61e92a3d83STim J. RobbinsIf
62e92a3d83STim J. Robbins.Fa dst
63e92a3d83STim J. Robbinsis not
64e92a3d83STim J. Robbins.Dv NULL ,
65e92a3d83STim J. Robbinsthe pointer pointed to by
66e92a3d83STim J. Robbins.Fa src
67e92a3d83STim J. Robbinsis updated to point to the character after the one that conversion stopped at.
68e92a3d83STim J. RobbinsIf conversion stops because a null character is encountered,
69279062faSRuslan Ermilov.Fa *src
70e92a3d83STim J. Robbinsis set to
71e92a3d83STim J. Robbins.Dv NULL .
72e92a3d83STim J. Robbins.Pp
73e92a3d83STim J. RobbinsThe
74279062faSRuslan Ermilov.Vt mbstate_t
75e92a3d83STim J. Robbinsargument,
76e92a3d83STim J. Robbins.Fa ps ,
77e92a3d83STim J. Robbinsis used to keep track of the shift state.
78e92a3d83STim J. RobbinsIf it is
79e92a3d83STim J. Robbins.Dv NULL ,
80e92a3d83STim J. Robbins.Fn mbsrtowcs
81e92a3d83STim J. Robbinsuses an internal, static
82279062faSRuslan Ermilov.Vt mbstate_t
83e92a3d83STim J. Robbinsobject.
84e92a3d83STim J. Robbins.Sh RETURN VALUES
85e92a3d83STim J. RobbinsThe
86e92a3d83STim J. Robbins.Fn mbsrtowcs
87e92a3d83STim J. Robbinsfunction returns the number of wide characters stored in
88e92a3d83STim J. Robbinsthe array pointed to by
89e92a3d83STim J. Robbins.Fa dst
90e92a3d83STim J. Robbinsif successful, otherwise it returns
91279062faSRuslan Ermilov.Po Vt size_t Pc Ns \-1 .
92e92a3d83STim J. Robbins.Sh ERRORS
93e92a3d83STim J. RobbinsThe
94e92a3d83STim J. Robbins.Fn mbsrtowcs
95e92a3d83STim J. Robbinsfunction will fail if:
96e92a3d83STim J. Robbins.Bl -tag -width Er
97e92a3d83STim J. Robbins.It Bq Er EILSEQ
98e92a3d83STim J. RobbinsAn invalid multibyte character sequence was encountered.
99e92a3d83STim J. Robbins.El
100e92a3d83STim J. Robbins.Sh SEE ALSO
101e92a3d83STim J. Robbins.Xr mbrtowc 3 ,
102e92a3d83STim J. Robbins.Xr mbstowcs 3 ,
103e92a3d83STim J. Robbins.Xr wcsrtombs 3
104e92a3d83STim J. Robbins.Sh STANDARDS
105e92a3d83STim J. RobbinsThe
106e92a3d83STim J. Robbins.Fn mbsrtowcs
107e92a3d83STim J. Robbinsfunction conforms to
108e92a3d83STim J. Robbins.St -isoC-99 .
109e92a3d83STim J. Robbins.Sh BUGS
110e92a3d83STim J. RobbinsThe current implementation does not support shift states.
111