1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" References consulted:
9 .\" GNU glibc-2 source code and manual
10 .\" Dinkumware C library reference http://www.dinkumware.com/
11 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
14 .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
15 .\" all rights reserved.
16 .\" Translated Tue Jan 11 00:56:19 JST 2000
17 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
19 .TH MBRLEN 3 1999-07-25 "GNU" "Linux Programmer's Manual"
22 .\"O mbrlen \- determine number of bytes in next multibyte character
23 mbrlen \- ¼¡¤Î¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤ÎŤµ¤ò¥Ð¥¤¥È¿ô¤ÇÊÖ¤¹
29 .BI "size_t mbrlen(const char *" s ", size_t " n ", mbstate_t *" ps );
35 .\"O function inspects at most \fIn\fP bytes of the multibyte
36 .\"O string starting at \fIs\fP and extracts the next complete multibyte character.
37 .\"O It updates the shift state \fI*ps\fP.
38 .\"O If the multibyte character is not the
39 .\"O null wide character, it returns the number of bytes that were consumed from
41 .\"O If the multibyte character is the null wide character, it resets the
42 .\"O shift state \fI*ps\fP to the initial state and returns 0.
44 ´Ø¿ô¤Ï \fIs\fP ¤«¤é»Ï¤Þ¤ë¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤ò
45 ºÇÂç \fIn\fP ¥Ð¥¤¥ÈÄ´¤Ù¤Æ¼¡¤Î´°Á´¤Ê¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤ò¼è¤ê½Ð¤¹¡£
46 Ʊ»þ¤Ë¥·¥Õ¥È¾õÂÖ \fI*ps\fP ¤ò¹¹¿·¤¹¤ë¡£
47 ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤¬¥Ê¥ë¥ï¥¤¥Éʸ»ú¤Ç¤Ê¤±¤ì¤Ð \fIs\fP ¤«¤é
48 ¾ÃÈñ¤¹¤ë¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£¥Ê¥ë¥ï¥¤¥Éʸ»ú¤Ê¤é¤Ð¥·¥Õ¥È¾õÂÖ \fI*ps\fP ¤ò
49 ½é´ü¾õÂÖ¤ËÌᤷ¤Æ¡¢0 ¤òÊÖ¤¹¡£
51 .\"O If the \fIn\fP bytes starting at \fIs\fP do not contain a complete multibyte
54 .\"O returns \fI(size_t)\ \-2\fP.
55 .\"O This can happen even if
56 .\"O \fIn\fP >= \fIMB_CUR_MAX\fP, if the multibyte string contains redundant shift
58 \fIs\fP ¤«¤é»Ï¤Þ¤ë \fIn\fP ¥Ð¥¤¥È¤Îʸ»úÎ󤬴°Á´¤Ê¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤ò´Þ¤ó¤Ç
61 ¤Ï \fI(size_t)\ \-2\fP ¤òÊÖ¤¹¡£
62 ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤Ë¾éĹ¤Ê¥·¥Õ¥È¥·¡¼¥±¥ó¥¹¤ò´Þ¤Þ¤ì¤Æ¤¤¤ë¤È
63 \fIn\fP >= \fIMB_CUR_MAX\fP ¤Î»þ¤Ë¤â¤³¤Î¤è¤¦¤Ê¤³¤È¤¬µ¯¤³¤ê¤¨¤ë¡£
65 .\"O If the multibyte string starting at \fIs\fP contains an invalid multibyte
66 .\"O sequence before the next complete character,
69 .\"O \fI(size_t)\ \-1\fP and sets \fIerrno\fP to \fBEILSEQ\fP.
71 .\"O the effects on \fI*ps\fP are undefined.
72 \fIs\fP ¤«¤é»Ï¤Þ¤ë¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎ󤬡¢¼¡¤Î´°Á´¤Êʸ»ú¤ÎÁ°¤Ë
73 ÉÔÀµ¤Ê¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ò´Þ¤ó¤Ç¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢
76 \fI(size_t)\ \-1\fP ¤òÊÖ¤· \fIerrno\fP ¤Ë \fBEILSEQ\fP ¤¬ÀßÄꤵ¤ì¤ë¡£
77 ¤³¤Î¾ì¹ç¤Î \fI*ps\fP ¤Ø¤Î±Æ¶Á¤Ï̤ÄêµÁ¤Ç¤¢¤ë¡£
79 .\"O If \fIps\fP is a NULL pointer, a static anonymous state only known to the
81 .\"O function is used instead.
82 \fIps\fP ¤¬ NULL ¥Ý¥¤¥ó¥¿¡¼¤Ê¤é¤Ð¡¢Âå¤ê¤Ë
84 ´Ø¿ô¤Î¤ß¤¬»ÈÍѤ¹¤ëÀÅŪ¤Ç̾Á°¤Î¤Ê¤¤¾õÂÖ¤¬»ÈÍѤµ¤ì¤ë¡£
85 .\"O .SH "RETURN VALUE"
89 .\"O function returns the number of bytes
90 .\"O parsed from the multibyte
91 .\"O sequence starting at \fIs\fP, if a non-null wide character was recognized.
92 ¥Ê¥ë¥ï¥¤¥Éʸ»ú°Ê³°¤Îʸ»ú¤ò³Îǧ¤·¤¿¾ì¹ç¤Ë¤Ï¡¢
95 ¤«¤é»Ï¤Þ¤ë¥Þ¥ë¥Á¥Ð¥¤¥ÈÎ󤫤é»ÈÍѤ·¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
96 .\"O It returns 0, if a null wide character was recognized.
98 .\"O .I "(size_t)\ \-1"
99 .\"O and sets \fIerrno\fP to \fBEILSEQ\fP, if an invalid multibyte sequence was
101 .\"O It returns \fI(size_t)\ \-2\fP if it couldn't parse a complete multibyte
102 .\"O character, meaning that \fIn\fP should be increased.
103 ¥Ê¥ë¥ï¥¤¥Éʸ»ú¤¬³Îǧ¤µ¤ì¤¿¾ì¹ç¤Ë¤Ï¥¼¥í¤òÊÖ¤¹¡£
104 ÉÔÀµ¤Ê¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ËÁø¶ø¤·¤¿¾ì¹ç¤Ë¤Ï
107 \fIerrno\fP ¤Ë \fBEILSEQ\fP ¤òÀßÄꤹ¤ë¡£
108 ´°Á´¤Ê¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤ò²òÀϤǤ¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¤Ï \fI(size_t)\ \-2\fP ¤òÊÖ¤¹¡£
109 ¤³¤ì¤Ï \fIn\fP ¤òÁý¤µ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
110 .\"O .SH "CONFORMING TO"
122 ¤ÎÆ°ºî¤Ï¸½ºß¤Î¥í¥±¡¼¥ë¤Î
124 ¥«¥Æ¥´¥ê¤Ë°Í¸¤·¤Æ¤¤¤ë¡£