mblen.3 (123222) | mblen.3 (128032) |
---|---|
1.\" Copyright (c) 2002, 2003 Tim J. Robbins. All rights reserved. | 1.\" Copyright (c) 2002-2004 Tim J. Robbins. All rights reserved. |
2.\" Copyright (c) 1993 3.\" The Regents of the University of California. All rights reserved. 4.\" 5.\" This code is derived from software contributed to Berkeley by 6.\" Donn Seeley of BSDI. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions --- 20 unchanged lines hidden (view full) --- 30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34.\" SUCH DAMAGE. 35.\" 36.\" From @(#)multibyte.3 8.1 (Berkeley) 6/4/93 37.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp | 2.\" Copyright (c) 1993 3.\" The Regents of the University of California. All rights reserved. 4.\" 5.\" This code is derived from software contributed to Berkeley by 6.\" Donn Seeley of BSDI. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions --- 20 unchanged lines hidden (view full) --- 30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34.\" SUCH DAMAGE. 35.\" 36.\" From @(#)multibyte.3 8.1 (Berkeley) 6/4/93 37.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp |
38.\" $FreeBSD: head/lib/libc/locale/mblen.3 123222 2003-12-07 06:33:52Z tjr $ | 38.\" $FreeBSD: head/lib/libc/locale/mblen.3 128032 2004-04-08 09:59:02Z tjr $ |
39.\" | 39.\" |
40.Dd November 19, 2003 | 40.Dd April 7, 2004 |
41.Dt MBLEN 3 42.Os 43.Sh NAME 44.Nm mblen 45.Nd get number of bytes in a character 46.Sh LIBRARY 47.Lb libc 48.Sh SYNOPSIS 49.In stdlib.h 50.Ft int 51.Fn mblen "const char *mbchar" "size_t nbytes" 52.Sh DESCRIPTION 53The 54.Fn mblen 55function computes the length in bytes 56of a multibyte character | 41.Dt MBLEN 3 42.Os 43.Sh NAME 44.Nm mblen 45.Nd get number of bytes in a character 46.Sh LIBRARY 47.Lb libc 48.Sh SYNOPSIS 49.In stdlib.h 50.Ft int 51.Fn mblen "const char *mbchar" "size_t nbytes" 52.Sh DESCRIPTION 53The 54.Fn mblen 55function computes the length in bytes 56of a multibyte character |
57.Fa mbchar . | 57.Fa mbchar 58according to the current conversion state. |
58Up to 59.Fa nbytes 60bytes are examined. 61.Pp 62A call with a null 63.Fa mbchar 64pointer returns nonzero if the current locale requires shift states, 65zero otherwise; 66if shift states are required, the shift state is reset to the initial state. 67.Sh RETURN VALUES 68If 69.Fa mbchar 70is 71.Dv NULL , 72the 73.Fn mblen 74function returns nonzero if shift states are supported, 75zero otherwise. | 59Up to 60.Fa nbytes 61bytes are examined. 62.Pp 63A call with a null 64.Fa mbchar 65pointer returns nonzero if the current locale requires shift states, 66zero otherwise; 67if shift states are required, the shift state is reset to the initial state. 68.Sh RETURN VALUES 69If 70.Fa mbchar 71is 72.Dv NULL , 73the 74.Fn mblen 75function returns nonzero if shift states are supported, 76zero otherwise. |
76If | 77.Pp 78Otherwise, if |
77.Fa mbchar | 79.Fa mbchar |
78is valid, | 80is not a null pointer, |
79.Fn mblen 80returns the number of bytes processed in 81.Fa mbchar , 82or \-1 if no multibyte character 83could be recognized or converted. | 81.Fn mblen 82returns the number of bytes processed in 83.Fa mbchar , 84or \-1 if no multibyte character 85could be recognized or converted. |
86In this case, 87.Fn mblen Ns No 's 88internal conversion state is undefined. |
|
84.Sh ERRORS 85The 86.Fn mblen 87function will fail if: 88.Bl -tag -width Er | 89.Sh ERRORS 90The 91.Fn mblen 92function will fail if: 93.Bl -tag -width Er |
89.\".It Bq Er EINVAL 90.\"Invalid argument. | |
91.It Bq Er EILSEQ 92An invalid multibyte sequence was detected. | 94.It Bq Er EILSEQ 95An invalid multibyte sequence was detected. |
96.It Bq Er EINVAL 97The internal conversion state is not valid. |
|
93.El 94.Sh SEE ALSO 95.Xr mbrlen 3 , | 98.El 99.Sh SEE ALSO 100.Xr mbrlen 3 , |
96.Xr mbtowc 3 | 101.Xr mbtowc 3 , 102.Xr multibyte 3 |
97.Sh STANDARDS 98The 99.Fn mblen 100function conforms to | 103.Sh STANDARDS 104The 105.Fn mblen 106function conforms to |
101.St -isoC . 102.Sh BUGS 103The current implementation does not support shift states. | 107.St -isoC-99 . |