1 .\" $NetBSD: src/lib/libc/locale/mblen.3,v 1.5 2004/01/24 16:58:54 wiz Exp $
2 .\" $DragonFly: src/lib/libc/locale/mblen.3,v 1.1 2005/03/12 00:18:01 joerg Exp $
4 .\" Copyright (c)2002 Citrus Project,
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" ----------------------------------------------------------------------
34 .Nd get number of bytes in a multibyte character
35 .\" ----------------------------------------------------------------------
38 .\" ----------------------------------------------------------------------
42 .Fn mblen "const char *s" "size_t n"
43 .\" ----------------------------------------------------------------------
47 function usually determines the number of bytes in
48 a multibyte character pointed to by
51 This function shall only examine max n bytes of the array beginning from
54 In state-dependent encodings,
56 may point the special sequence bytes to change the shift-state.
57 Although such sequence bytes corresponds to no individual
61 changes the own state by them and treats them
62 as if they are a part of the subsequent multibyte character.
70 need to form an entire multibyte character.
71 Otherwise, this function causes an error.
74 is equivalent to the following call, except the internal state of the
76 function is not affected:
77 .Bd -literal -offset indent
81 Calling any other functions in
83 never changes the internal
90 category changed to that of the current locale.
93 calls cause the internal state of this function to be indeterminate.
99 category of the current locale.
101 These are the special cases:
102 .Bl -tag -width 0123456789
105 initializes its own internal state to an initial state, and
106 determines whether the current encoding is state-dependent.
107 This function returns 0 if the encoding is state-independent,
113 bytes of the array pointed to by
115 never form a complete character.
120 .\" ----------------------------------------------------------------------
125 .Bl -tag -width 0123456789
128 points to a null byte
131 The value returned is
132 a number of bytes for the valid multibyte character pointed to by
134 There are no cases that this value is greater than
141 points to an invalid or incomplete multibyte character.
146 to indicate the error.
156 .Bl -tag -width 0123456789
158 The current encoding is state-independent.
160 The current encoding is state-dependent.
162 .\" ----------------------------------------------------------------------
165 may cause an error in the following case:
169 points to an invalid or incomplete multibyte character.
171 .\" ----------------------------------------------------------------------
176 .\" ----------------------------------------------------------------------