18b810927STim J. Robbins.\" Copyright (c) 2002-2004 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$ 261949a347STim J. Robbins.Dd July 21, 2004 27e92a3d83STim J. Robbins.Dt MBSRTOWCS 3 28e92a3d83STim J. Robbins.Os 29e92a3d83STim J. Robbins.Sh NAME 301949a347STim J. Robbins.Nm mbsrtowcs , 311949a347STim J. Robbins.Nm mbsnrtowcs 32e92a3d83STim J. Robbins.Nd "convert a character string to a wide-character string (restartable)" 33e92a3d83STim J. Robbins.Sh LIBRARY 34e92a3d83STim J. Robbins.Lb libc 35e92a3d83STim J. Robbins.Sh SYNOPSIS 36e92a3d83STim J. Robbins.In wchar.h 37e92a3d83STim J. Robbins.Ft size_t 38279062faSRuslan Ermilov.Fo mbsrtowcs 39279062faSRuslan Ermilov.Fa "wchar_t * restrict dst" "const char ** restrict src" "size_t len" 40279062faSRuslan Ermilov.Fa "mbstate_t * restrict ps" 41279062faSRuslan Ermilov.Fc 421949a347STim J. Robbins.Ft size_t 431949a347STim J. Robbins.Fo mbsnrtowcs 441949a347STim J. Robbins.Fa "wchar_t * restrict dst" "const char ** restrict src" "size_t nms" 451949a347STim J. Robbins.Fa "size_t len" "mbstate_t * restrict ps" 461949a347STim J. Robbins.Fc 47e92a3d83STim J. Robbins.Sh DESCRIPTION 48e92a3d83STim J. RobbinsThe 49e92a3d83STim J. Robbins.Fn mbsrtowcs 50e92a3d83STim J. Robbinsfunction converts a sequence of multibyte characters pointed to indirectly by 51e92a3d83STim J. Robbins.Fa src 52e92a3d83STim J. Robbinsinto a sequence of corresponding wide characters and stores at most 53e92a3d83STim J. Robbins.Fa len 54e92a3d83STim J. Robbinsof them in the 55279062faSRuslan Ermilov.Vt wchar_t 56e92a3d83STim J. Robbinsarray pointed to by 57e92a3d83STim J. Robbins.Fa dst , 58279062faSRuslan Ermilovuntil it encounters a terminating null character 59279062faSRuslan Ermilov.Pq Li '\e0' . 60e92a3d83STim J. Robbins.Pp 61e92a3d83STim J. RobbinsIf 62e92a3d83STim J. Robbins.Fa dst 63e92a3d83STim J. Robbinsis 64e92a3d83STim J. Robbins.Dv NULL , 65e92a3d83STim J. Robbinsno characters are stored. 66e92a3d83STim J. Robbins.Pp 67e92a3d83STim J. RobbinsIf 68e92a3d83STim J. Robbins.Fa dst 69e92a3d83STim J. Robbinsis not 70e92a3d83STim J. Robbins.Dv NULL , 71e92a3d83STim J. Robbinsthe pointer pointed to by 72e92a3d83STim J. Robbins.Fa src 73e92a3d83STim J. Robbinsis updated to point to the character after the one that conversion stopped at. 74e92a3d83STim J. RobbinsIf conversion stops because a null character is encountered, 75279062faSRuslan Ermilov.Fa *src 76e92a3d83STim J. Robbinsis set to 77e92a3d83STim J. Robbins.Dv NULL . 78e92a3d83STim J. Robbins.Pp 79e92a3d83STim J. RobbinsThe 80279062faSRuslan Ermilov.Vt mbstate_t 81e92a3d83STim J. Robbinsargument, 82e92a3d83STim J. Robbins.Fa ps , 83e92a3d83STim J. Robbinsis used to keep track of the shift state. 84e92a3d83STim J. RobbinsIf it is 85e92a3d83STim J. Robbins.Dv NULL , 86e92a3d83STim J. Robbins.Fn mbsrtowcs 87e92a3d83STim J. Robbinsuses an internal, static 88279062faSRuslan Ermilov.Vt mbstate_t 898b810927STim J. Robbinsobject, which is initialized to the initial conversion state 908b810927STim J. Robbinsat program startup. 911949a347STim J. Robbins.Pp 921949a347STim J. RobbinsThe 931949a347STim J. Robbins.Fn mbsnrtowcs 941949a347STim J. Robbinsfunction behaves identically to 951949a347STim J. Robbins.Fn mbsrtowcs , 961949a347STim J. Robbinsexcept that conversion stops after reading at most 971949a347STim J. Robbins.Fa nms 981949a347STim J. Robbinsbytes from the buffer pointed to by 991949a347STim J. Robbins.Fa src . 100e92a3d83STim J. Robbins.Sh RETURN VALUES 101e92a3d83STim J. RobbinsThe 102e92a3d83STim J. Robbins.Fn mbsrtowcs 1031949a347STim J. Robbinsand 1041949a347STim J. Robbins.Fn mbsnrtowcs 1051949a347STim J. Robbinsfunctions return the number of wide characters stored in 106e92a3d83STim J. Robbinsthe array pointed to by 107e92a3d83STim J. Robbins.Fa dst 108e92a3d83STim J. Robbinsif successful, otherwise it returns 109279062faSRuslan Ermilov.Po Vt size_t Pc Ns \-1 . 110e92a3d83STim J. Robbins.Sh ERRORS 111e92a3d83STim J. RobbinsThe 112e92a3d83STim J. Robbins.Fn mbsrtowcs 1131949a347STim J. Robbinsand 1141949a347STim J. Robbins.Fn mbsnrtowcs 1151949a347STim J. Robbinsfunctions will fail if: 116e92a3d83STim J. Robbins.Bl -tag -width Er 117e92a3d83STim J. Robbins.It Bq Er EILSEQ 118e92a3d83STim J. RobbinsAn invalid multibyte character sequence was encountered. 1198b810927STim J. Robbins.It Bq Er EINVAL 1208b810927STim J. RobbinsThe conversion state is invalid. 121e92a3d83STim J. Robbins.El 122e92a3d83STim J. Robbins.Sh SEE ALSO 123e92a3d83STim J. Robbins.Xr mbrtowc 3 , 124e92a3d83STim J. Robbins.Xr mbstowcs 3 , 1258b810927STim J. Robbins.Xr multibyte 3 , 126e92a3d83STim J. Robbins.Xr wcsrtombs 3 127e92a3d83STim J. Robbins.Sh STANDARDS 128e92a3d83STim J. RobbinsThe 129e92a3d83STim J. Robbins.Fn mbsrtowcs 130e92a3d83STim J. Robbinsfunction conforms to 131e92a3d83STim J. Robbins.St -isoC-99 . 1321949a347STim J. Robbins.Pp 1331949a347STim J. RobbinsThe 1341949a347STim J. Robbins.Fn mbsnrtowcs 1351949a347STim J. Robbinsfunction is an extension to the standard. 136