xref: /freebsd/lib/libc/locale/mblen.3 (revision dc36d6f9bb1753f3808552f3afd30eda9a7b206a)
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.
16*fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
17bc0b3a18STim J. Robbins.\"    may be used to endorse or promote products derived from this software
18bc0b3a18STim J. Robbins.\"    without specific prior written permission.
19bc0b3a18STim J. Robbins.\"
20bc0b3a18STim J. Robbins.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21bc0b3a18STim J. Robbins.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22bc0b3a18STim J. Robbins.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23bc0b3a18STim J. Robbins.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24bc0b3a18STim J. Robbins.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25bc0b3a18STim J. Robbins.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26bc0b3a18STim J. Robbins.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27bc0b3a18STim J. Robbins.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28bc0b3a18STim J. Robbins.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29bc0b3a18STim J. Robbins.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30bc0b3a18STim J. Robbins.\" SUCH DAMAGE.
31bc0b3a18STim J. Robbins.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
32bc0b3a18STim J. Robbins.\"
3378c4a3f2STim J. Robbins.Dd April 11, 2004
34bc0b3a18STim J. Robbins.Dt MBLEN 3
35bc0b3a18STim J. Robbins.Os
36bc0b3a18STim J. Robbins.Sh NAME
37bc0b3a18STim J. Robbins.Nm mblen
38bc0b3a18STim J. Robbins.Nd get number of bytes in a character
39bc0b3a18STim J. Robbins.Sh LIBRARY
40bc0b3a18STim J. Robbins.Lb libc
41bc0b3a18STim J. Robbins.Sh SYNOPSIS
42bc0b3a18STim J. Robbins.In stdlib.h
43bc0b3a18STim J. Robbins.Ft int
44bc0b3a18STim J. Robbins.Fn mblen "const char *mbchar" "size_t nbytes"
45bc0b3a18STim J. Robbins.Sh DESCRIPTION
46bc0b3a18STim J. RobbinsThe
47bc0b3a18STim J. Robbins.Fn mblen
48bc0b3a18STim J. Robbinsfunction computes the length in bytes
49bc0b3a18STim J. Robbinsof a multibyte character
508b810927STim J. Robbins.Fa mbchar
518b810927STim J. Robbinsaccording to the current conversion state.
52bc0b3a18STim J. RobbinsUp to
53bc0b3a18STim J. Robbins.Fa nbytes
54bc0b3a18STim J. Robbinsbytes are examined.
55bc0b3a18STim J. Robbins.Pp
56bc0b3a18STim J. RobbinsA call with a null
57bc0b3a18STim J. Robbins.Fa mbchar
58bc0b3a18STim J. Robbinspointer returns nonzero if the current locale requires shift states,
59bc0b3a18STim J. Robbinszero otherwise;
60bc0b3a18STim J. Robbinsif shift states are required, the shift state is reset to the initial state.
61bc0b3a18STim J. Robbins.Sh RETURN VALUES
62bc0b3a18STim J. RobbinsIf
63bc0b3a18STim J. Robbins.Fa mbchar
64bc0b3a18STim J. Robbinsis
65bc0b3a18STim J. Robbins.Dv NULL ,
66bc0b3a18STim J. Robbinsthe
67bc0b3a18STim J. Robbins.Fn mblen
68bc0b3a18STim J. Robbinsfunction returns nonzero if shift states are supported,
69bc0b3a18STim J. Robbinszero otherwise.
708b810927STim J. Robbins.Pp
718b810927STim J. RobbinsOtherwise, if
72bc0b3a18STim J. Robbins.Fa mbchar
738b810927STim J. Robbinsis not a null pointer,
74bc0b3a18STim J. Robbins.Fn mblen
7578c4a3f2STim J. Robbinseither returns 0 if
7678c4a3f2STim J. Robbins.Fa mbchar
7778c4a3f2STim J. Robbinsrepresents the null wide character, or returns
7878c4a3f2STim J. Robbinsthe number of bytes processed in
79bc0b3a18STim J. Robbins.Fa mbchar ,
8078c4a3f2STim J. Robbinsor returns \-1 if no multibyte character
81bc0b3a18STim J. Robbinscould be recognized or converted.
828b810927STim J. RobbinsIn this case,
83b9384efcSRuslan Ermilov.Fn mblen Ns 's
848b810927STim J. Robbinsinternal conversion state is undefined.
85bc0b3a18STim J. Robbins.Sh ERRORS
86bc0b3a18STim J. RobbinsThe
87bc0b3a18STim J. Robbins.Fn mblen
88bc0b3a18STim J. Robbinsfunction will fail if:
89bc0b3a18STim J. Robbins.Bl -tag -width Er
90bc0b3a18STim J. Robbins.It Bq Er EILSEQ
91bc0b3a18STim J. RobbinsAn invalid multibyte sequence was detected.
928b810927STim J. Robbins.It Bq Er EINVAL
938b810927STim J. RobbinsThe internal conversion state is not valid.
94bc0b3a18STim J. Robbins.El
95bc0b3a18STim J. Robbins.Sh SEE ALSO
96bc0b3a18STim J. Robbins.Xr mbrlen 3 ,
978b810927STim J. Robbins.Xr mbtowc 3 ,
988b810927STim J. Robbins.Xr multibyte 3
99bc0b3a18STim J. Robbins.Sh STANDARDS
100bc0b3a18STim J. RobbinsThe
101bc0b3a18STim J. Robbins.Fn mblen
102bc0b3a18STim J. Robbinsfunction conforms to
1038b810927STim J. Robbins.St -isoC-99 .
104