OSDN Git Service

(split) Apply minor changes from v3.32 to v3.35 in the upstream.
[linuxjm/LDP_man-pages.git] / draft / man3 / wcsnrtombs.3
1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
2 .\"
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.
7 .\"
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
12 .\"
13 .\" About this Japanese page, please contact to JM Project <JM@linux.or.jp>
14 .\" Translated Fri Oct 22 01:12:12 JST 1999
15 .\"           by FUJIWARA Teruyoshi <fujiwara@linux.or.jp>
16 .\"
17 .TH WCSNRTOMBS 3  2011-10-01 "GNU" "Linux Programmer's Manual"
18 .\"O .SH NAME
19 .SH Ì¾Á°
20 .\"O wcsnrtombs \- convert a wide-character string to a multibyte string
21 wcsnrtombs \- ¥ï¥¤¥Éʸ»úʸ»úÎó¤ò¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤ËÊÑ´¹¤¹¤ë
22 .\"O .SH SYNOPSIS
23 .SH ½ñ¼°
24 .nf
25 .B #include <wchar.h>
26 .sp
27 .BI "size_t wcsnrtombs(char *" dest ", const wchar_t **" src ", size_t " nwc ,
28 .BI "                  size_t " len ", mbstate_t *" ps );
29 .fi
30 .sp
31 .in -4n
32 .\"O Feature Test Macro Requirements for glibc (see
33 .\"O .BR feature_test_macros (7)):
34 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
35 .RB ( feature_test_macros (7)
36 »²¾È):
37 .in
38 .sp
39 .BR wcsnrtombs ():
40 .PD 0
41 .ad l
42 .RS 4
43 .TP 4
44 .\"O Since glibc 2.10:
45 glibc 2.10 °Ê¹ß:
46 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
47 .TP
48 .\"O Before glibc 2.10:
49 glibc 2.10 ¤è¤êÁ°:
50 _GNU_SOURCE
51 .RE
52 .ad
53 .PD
54 .\"O .SH DESCRIPTION
55 .SH ÀâÌÀ
56 .\"O The
57 .\"O .BR wcsnrtombs ()
58 .\"O function is like the
59 .\"O .BR wcsrtombs (3)
60 .\"O function,
61 .\"O except that the number of wide characters to be converted,
62 .\"O starting at \fI*src\fP, is limited to \fInwc\fP.
63 .BR wcsnrtombs ()
64 ´Ø¿ô¤Ï¡¢
65 .BR wcsrtombs ()
66 ´Ø¿ô¤Ë»÷¤Æ¤¤¤ë¡£¤¿¤À¤·¡¢
67 ÊÑ´¹¤µ¤ì¤ë¥ï¥¤¥Éʸ»ú¤Î¿ô¤¬(\fI*src\fP ¤«¤é¿ô¤¨¤Æ) \fInwc\fP Ê¸»ú¤ËÀ©¸Â
68 ¤µ¤ì¤Æ¤¤¤ëÅÀ¤¬°Û¤Ê¤ë¡£
69 .PP
70 .\"O If \fIdest\fP is not a NULL pointer,
71 .\"O the
72 .\"O .BR wcsnrtombs ()
73 .\"O function converts
74 .\"O at most \fInwc\fP wide characters from
75 .\"O the wide-character string \fI*src\fP to a multibyte string starting at
76 .\"O \fIdest\fP.
77 .\"O At most \fIlen\fP bytes are written to \fIdest\fP.
78 .\"O The shift state
79 .\"O \fI*ps\fP is updated.
80 .\"O The conversion is effectively performed by repeatedly
81 .\"O calling
82 .\"O .IR "wcrtomb(dest, *src, ps)" ,
83 .\"O as long as this call succeeds,
84 .\"O and then incrementing \fIdest\fP by the
85 .\"O number of bytes written and \fI*src\fP
86 .\"O by one.
87 .\"O The conversion can stop for three reasons:
88 \fIdest\fP ¤¬ NULL ¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¡¢
89 .BR wcsnrtombs ()
90 ´Ø¿ô¤Ï
91 ¥ï¥¤¥Éʸ»úʸ»úÎó¤ÎºÇÂç \fInwc\fP ¸Ä¤Þ¤Ç¤Î¥ï¥¤¥Éʸ»ú¤ò \fIdest\fP ¤«¤é
92 »Ï¤Þ¤ë¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤ËÊÑ´¹¤¹¤ë¡£\fIdest\fP ¤Ë¤ÏºÇÂç \fIlen\fP ¥Ð¥¤
93 ¥È¤Þ¤Ç½ñ¤­¹þ¤Þ¤ì¤ë¡£¥·¥Õ¥È¾õÂÖ \fI*ps\fP ¤Ï¹¹¿·¤µ¤ì¤ë¡£¼ÂºÝ¤Î¸ú²Ì¤È¤·
94 ¤Æ¤Ï¡¢¤³¤ÎÊÑ´¹¤Ï°Ê²¼¤ÎÆ°ºî¤ÈƱ¤¸¤Ë¤Ê¤ë:
95 .IR "wcrtomb(dest, *src, ps)"
96 ¤ò¸Æ¤Ó¡¢À®¸ù¤¬Ê֤俤é
97 \fIdest\fP ¤ò½ñ¤­¹þ¤ó¤À¥Ð¥¤¥È¿ô¤À¤±Áý¤ä¤·¡¢\fI*src\fP ¤ò 1 Áý¤ä¤¹¡£
98 ¤½¤·¤Æ¡¢wcrtomb ¤¬À®¸ù¤òÊÖ¤¹¸Â¤ê¤³¤ì¤ò·«¤êÊÖ¤¹¡£
99 ÊÑ´¹¤¬»ß¤Þ¤ëÍýͳ¤Ï 3 ¤Ä¹Í¤¨¤é¤ì¤ë:
100 .PP
101 .\"O 1. A wide character has been encountered that can not be represented as a
102 .\"O multibyte sequence (according to the current locale).
103 .\"O In this case \fI*src\fP
104 .\"O is left pointing to the invalid wide character,
105 .\"O .I (size_t)\ \-1
106 .\"O is returned,
107 .\"O and \fIerrno\fP is set to \fBEILSEQ\fP.
108 1. (¸½ºß¤Î¥í¥±¡¼¥ë¤Ë´ð¤Å¤¤¤Æ)¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤Çɽ¸½¤Ç¤­¤Ê¤¤¥ï¥¤¥Éʸ»ú¤Ë
109 ½Ð²ñ¤Ã¤¿¾ì¹ç¡£¤³¤Î¾ì¹ç¤Ï¡¢\fI*src\fP ¤ÏÉÔÀµ¤Ê¥ï¥¤¥Éʸ»ú¤ò»Ø¤·¤¿¾õÂ֤ˤʤꡢ
110 .I (size_t)\ \-1
111 ¤¬ÊÖ¤µ¤ì¡¢\fIerrno\fP ¤Ë \fBEILSEQ\fP ¤¬ÀßÄꤵ¤ì¤ë¡£
112 .PP
113 .\"O 2. \fInwc\fP wide characters have been
114 .\"O- converted without encountering a L\(aq\\0\(aq,
115 .\"O+ converted without encountering a null wide character (L\(aq\\0\(aq),
116 .\"O or the length limit forces a stop.
117 .\"O In this case \fI*src\fP is left pointing
118 .\"O to the next wide character to be converted, and the number of bytes written
119 .\"O to \fIdest\fP is returned.
120 2. NULL ¥ï¥¤¥Éʸ»ú (L\(aq\\0\(aq) ¤Ë½Ð²ñ¤ï¤Ê¤¤¤Ç \fInwc\fP ¸Ä¤Î¥ï¥¤¥Éʸ»ú¤ò
121 ÊÑ´¹¤·¤¿¾ì¹ç¤«¡¢Ä¹¤µ¤ÎÀ©¸Â¤Ë¤è¤Ã¤ÆÊÑ´¹¤¬»ß¤á¤é¤ì¤¿¾ì¹ç¡£
122 ¤³¤Î¾ì¹ç¤Ë¤Ï¡¢\fI*src\fP ¤Ï¼¡¤ËÊÑ´¹¤µ¤ì¤ë¤Ù¤­¥ï¥¤¥Éʸ»ú¤ò»Ø¤·¤¿¾õÂ֤ˤʤꡢ
123 \fIdest\fP ¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤¬ÊÖ¤µ¤ì¤ë¡£
124 .PP
125 .\"O 3. The wide-character string has been completely converted, including the
126 .\"O- terminating L\(aq\\0\(aq (which has the side effect of bringing back \fI*ps\fP
127 .\"O+ terminating null wide character (which has the side effect of bringing back \fI*ps\fP
128 .\"O to the initial state).
129 .\"O In this case \fI*src\fP is set to NULL, and the number
130 .\"O- of bytes written to \fIdest\fP, excluding the terminating \(aq\\0\(aq byte, is
131 .\"O+ of bytes written to \fIdest\fP, excluding the terminating null, is
132 .\"O returned.
133 3. ¥ï¥¤¥Éʸ»úÎ󤬽ªÃ¼¤Î L\(aq\\0\(aq (¤³¤ì¤Ë¤Ï \fI*ps\fP ¤ò½é´ü¾õÂÖ¤ËÌ᤹¤È
134 ¤¤¤¦ÉûºîÍѤ¬¤¢¤ë)¤â´Þ¤á¤ÆÁ´¤ÆÊÑ´¹¤µ¤ì¤¿¾ì¹ç¡£¤³¤Î¾ì¹ç¤Ë¤Ï \fI*src\fP
135 ¤Ë NULL ¤¬ÀßÄꤵ¤ì¡¢\fIdest\fP ¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤¬ÊÖ¤µ¤ì¤ë
136 (½ªÃ¼¤Î \(aq\\0\(aq ¤Ï¿ô¤¨¤Ê¤¤)¡£
137 .PP
138 .\"O If \fIdest\fP is NULL, \fIlen\fP is ignored,
139 .\"O and the conversion proceeds as above,
140 .\"O except that the converted bytes are not written out to memory, and that
141 .\"O no destination length limit exists.
142 \fIdest\fP ¤¬ NULL ¤Ê¤é¤Ð \fIlen\fP ¤Ï̵»ë¤µ¤ì¤ÆÁ°½Ò¤Î¤è¤¦¤ËÊÑ´¹¤¬¹Ô¤ï
143 ¤ì¤ë¤¬¡¢ÊÑ´¹¤µ¤ì¤¿¥Ð¥¤¥È¥Ç¡¼¥¿¤Ï¥á¥â¥ê¤Ë½ñ¤­½Ð¤µ¤ì¤Ê¤¤ÅÀ¤È¡¢½ÐÎÏÀè¤ÎĹ
144 ¤µ¤ÎÀ©¸Â¤¬¤Ê¤¤ÅÀ¤¬°Û¤Ê¤ë¡£
145 .PP
146 .\"O In both of the above cases,
147 .\"O if \fIps\fP is a NULL pointer, a static anonymous
148 .\"O state only known to the wcsnrtombs function is used instead.
149 ¾åµ­¤Î¤¤¤º¤ì¤Î¾ì¹ç¤â¡¢\fIps\fP ¤¬ NULL ¥Ý¥¤¥ó¥¿¤Ê¤é¤Ð¡¢wcsnrtombs ´Ø¿ô
150 ¤À¤±¤¬ÃΤäƤ¤¤ëÀÅŪ¤Êƿ̾¤Î¾õÂÖ¤¬¥·¥Õ¥È¾õÂÖ¤ÎÂå¤ï¤ê¤ËÍѤ¤¤é¤ì¤ë¡£
151 .PP
152 .\"O The programmer must ensure that there is room for at least \fIlen\fP bytes
153 .\"O at \fIdest\fP.
154 ¥×¥í¥°¥é¥Þ¤Ï¾¯¤Ê¤¯¤È¤â \fIlen\fP ¥Ð¥¤¥È¤ÎÎΰè¤ò \fIdest\fP ¤Ë³ÎÊݤ·¤Ê
155 ¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
156 .\"O .SH "RETURN VALUE"
157 .SH ÊÖ¤êÃÍ
158 .\"O The
159 .\"O .BR wcsnrtombs ()
160 .\"O function returns
161 .\"O the number of bytes that make up the
162 .\"O converted part of multibyte sequence,
163 .\"O not including the terminating null.
164 .BR wcsnrtombs ()
165 ´Ø¿ô¤Ï¡¢ÊÑ´¹¤·¤ÆÆÀ¤é¤ì¤¿¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤Î¥Ð¥¤¥È¿ô¤òÊÖ
166 ¤¹¡£¤³¤ì¤Ë¤Ï½ªÃ¼¤Î NULL ¤Ï´Þ¤Þ¤Ê¤¤¡£
167 .\"O If a wide character was encountered which
168 .\"O could not be converted,
169 .\"O .I (size_t)\ \-1
170 .\"O is returned, and \fIerrno\fP set to \fBEILSEQ\fP.
171 ÊÑ´¹¤Ç¤­¤Ê¤¤¥ï¥¤¥Éʸ»ú¤Ë½Ð²ñ¤Ã¤¿¾ì¹ç¤Ë¤Ï
172 .I (size_t)\ \-1
173 ¤¬ÊÖ¤µ¤ì¡¢ \fIerrno\fP ¤Ë \fBEILSEQ\fP ¤¬ÀßÄꤵ¤ì¤ë¡£
174 .\"O .SH "CONFORMING TO"
175 .SH ½àµò
176 POSIX.1-2008.
177 .\"O .SH NOTES
178 .SH Ãí°Õ
179 .\"O The behavior of
180 .\"O .BR wcsnrtombs ()
181 .\"O depends on the
182 .\"O .B LC_CTYPE
183 .\"O category of the
184 .\"O current locale.
185 .BR wcsnrtombs ()
186 ¤ÎÆ°ºî¤Ï¸½ºß¤Î¥í¥±¡¼¥ë¤Î
187 .B LC_CTYPE
188 ¥«¥Æ¥´¥ê¤Ë°Í¸¤¹¤ë¡£
189 .PP
190 .\"O Passing NULL as \fIps\fP is not multithread safe.
191 \fIps\fP ¤Ë NULL ¤òÅϤ·¤¿ºÝ¤ÎÆ°ºî¤Ï¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¥»¡¼¥Õ¤Ç¤Ê¤¤¡£
192 .\"O .SH "SEE ALSO"
193 .SH ´ØÏ¢¹àÌÜ
194 .BR iconv (3),
195 .BR wcsrtombs (3)