OSDN Git Service

(split) LDP_man-pages: release ioctl.2 [JM:00378]
[linuxjm/LDP_man-pages.git] / draft / man3 / strfmon.3
1 .\" Copyright (c) 2000 Andries Brouwer (aeb@cwi.nl)
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 .\" The GNU General Public License's references to "object code"
9 .\" and "executables" are to be interpreted as the output of any
10 .\" document formatting or typesetting system, including
11 .\" intermediate and printed output.
12 .\"
13 .\" This manual is distributed in the hope that it will be useful,
14 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 .\" GNU General Public License for more details.
17 .\"
18 .\" You should have received a copy of the GNU General Public
19 .\" License along with this manual; if not, write to the Free
20 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
21 .\" USA.
22 .\"
23 .\" Japanese Version Copyright (c) 2001 NAKANO Takeo all rights reserved.
24 .\" Translated Thu Fri 08 2001 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
25 .\"
26 .\"WORD:        numeric fill character  ¿ôÃÍËä¤áʸ»ú
27 .\"WORD:        grouping character      ¥°¥ë¡¼¥×²½Ê¸»ú
28 .\"WORD:        left precision          º¸ÀºÅÙ
29 .\"WORD:        right precision         º¸ÀºÅÙ
30 .\"WORD:        radix (character)       ´ð¿ôÅÀ(ʸ»ú)
31 .\"WORD:        conversion character    ÊÑ´¹Ê¸»ú
32 .\"WORD:        international currency format   ¹ñºÝÄ̲ߥե©¡¼¥Þ¥Ã¥È
33 .\"WORD:        national currency format        ¹ñÆâÄ̲ߥե©¡¼¥Þ¥Ã¥È
34 .\"
35 .TH STRFMON 3 2000-12-05 "Linux" "Linux Programmer's Manual"
36 .\"O .SH NAME
37 .\"O strfmon \- convert monetary value to a string
38 .SH Ì¾Á°
39 strfmon \- ¶â³Û¤ÎÃͤòʸ»úÎó¤ËÊÑ´¹¤¹¤ë
40 .\"O .SH SYNOPSIS
41 .SH ½ñ¼°
42 .B #include <monetary.h>
43 .sp
44 .BI "ssize_t strfmon(char *" s ", size_t " max ", const char *" format ,
45 .B "...);"
46 .\"O .SH DESCRIPTION
47 .SH ÀâÌÀ
48 .\"O The
49 .\"O .BR strfmon ()
50 .\"O function formats the specified amounts
51 .\"O according to the format specification \fIformat\fP and places the
52 .\"O result in the character array \fIs\fP of size \fImax\fP.
53 .BR strfmon ()
54 ´Ø¿ô¤Ï¡¢»ØÄꤵ¤ì¤¿¿ôÎ̤ò
55 .I format
56 ¤Ç»ØÄꤵ¤ì¤¿¥Õ¥©¡¼¥Þ¥Ã¥È¤Ë¤·¤¿¤¬¤Ã¤ÆÀ°·Á¤·¡¢
57 ·ë²Ì¤ò¥µ¥¤¥º
58 .I max
59 ¤Îʸ»úÇÛÎó
60 .I s
61 ¤Ë½ñ¤­¤³¤à¡£
62 .PP
63 .\"O Ordinary characters in \fIformat\fP are copied to \fIs\fP
64 .\"O without conversion.
65 .\"O Conversion specifiers are introduced by a \(aq%\(aq
66 .\"O character.
67 .\"O Immediately following it there can be zero or more
68 .\"O of the following flags:
69 .I format
70 Ãæ¤ÎÄ̾ï¤Îʸ»ú¤Ï¡¢ÊÑ´¹¤µ¤ì¤º¤Ë¤½¤Î¤Þ¤Þ
71 .I s
72 ¤Ë¥³¥Ô¡¼¤µ¤ì¤ë¡£ÊÑ´¹»ØÄê¤Ï \(aq%\(aq Ê¸»ú¤Ç»Ï¤Þ¤ë¡£
73 ¤³¤Îľ¸å¤Ë¤Ï¡¢°Ê²¼¤Î¥Õ¥é¥°¤ò 0 ¸Ä°Ê¾å³¤±¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
74 .TP
75 .BI = f
76 .\"O The single-byte character
77 .\"O .I f
78 .\"O is used as the numeric fill character (to be used with
79 .\"O a left precision, see below).
80 .\"O When not specified, the space character is used.
81 1 ¥Ð¥¤¥Èʸ»ú
82 .I f
83 ¤ò¿ôÃÍËä¤áʸ»ú (numeric fill character) ¤Ë¤¹¤ë
84 (º¸ÀºÅ٤ȶ¦¤ËÍѤ¤¤ë¡£°Ê²¼¤ò»²¾È)¡£
85 »ØÄꤵ¤ì¤Ê¤¤¤È¡¢¥¹¥Ú¡¼¥¹Ê¸»ú¤¬ÍѤ¤¤é¤ì¤ë¡£
86 .TP
87 .B ^
88 .\"O Do not use any grouping characters that might be defined
89 .\"O for the current locale.
90 .\"O By default, grouping is enabled.
91 ¸½ºß¤Î¥í¥±¡¼¥ë¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤Ç¤¢¤í¤¦¥°¥ë¡¼¥×²½Ê¸»ú (grouping character)
92 ¤ò°ìÀڻȤï¤Ê¤¤¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¥°¥ë¡¼¥×²½¤ÏÍ­¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
93 .TP
94 .\"O .BR ( " or " +
95 .BR ( " ¤Þ¤¿¤Ï " +
96 .\"O The ( flag indicates that negative amounts should be enclosed between
97 .\"O parentheses.
98 .\"O The + flag indicates that signs should be handled
99 .\"O in the default way, that is, amounts are preceded by the locale's
100 .\"O sign indication, for example, nothing for positive, "\-" for negative.
101 ( ¥Õ¥é¥°¤Ï¡¢Éé¤Î¿ôÃͤò³ç¸Ì¤Ç³ç¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
102 + ¥Õ¥é¥°¤ÏÉä¹æ¤ò¥Ç¥Õ¥©¥ë¥È¤Î¤è¤¦¤Ë¼è¤ê°·¤¦¤³¤È¤ò°ÕÌ£¤¹¤ë
103 (¤¹¤Ê¤ï¤Á¿ôÃͤÎÁ°¤Ë¥í¥±¡¼¥ë¤ÎÉä¹æ¥Þ¡¼¥¯¤¬ÃÖ¤«¤ì¤ë¡£
104 Î㤨¤ÐÀµ¤Ê¤é¤Ê¤Ë¤â¤Ê¤¯¡¢Éé¤Ê¤é \(aq\-\(aq ¤òÃÖ¤¯¡¢¤Ê¤É)¡£
105 .TP
106 .B !
107 .\"O Omit the currency symbol.
108 Ä̲ߥ·¥ó¥Ü¥ë¤ò¾Êά¤¹¤ë¡£
109 .TP
110 .B \-
111 .\"O Left justify all fields.
112 .\"O The default is right justification.
113 ¤¹¤Ù¤Æ¤Î¥Õ¥£¡¼¥ë¥É¤òº¸µÍ¤á¤Ë¤¹¤ë¡£¥Ç¥Õ¥©¥ë¥È¤Ï±¦µÍ¤á¡£
114 .LP
115 .\"O Next, there may be a field width: a decimal digit string specifying
116 .\"O a minimum field width in bytes.
117 .\"O The default is 0.
118 .\"O A result smaller than this width is padded with spaces
119 .\"O (on the left, unless the left-justify flag was given).
120 ¼¡¤Î°ÌÃ֤ˤϡ¢¥Õ¥£¡¼¥ë¥É¤ÎÉý¤ò»ØÄê¤Ç¤­¤ë¡£
121 10 ¿Ê¤Î¿ôÃÍʸ»úÎó¤Ç¡¢¥Õ¥£¡¼¥ë¥É¤ÎºÇ¾®Éý¤ò¥Ð¥¤¥Èñ°Ì¤Ç»ØÄꤹ¤ë¡£
122 ¥Ç¥Õ¥©¥ë¥È¤Ï 0¡£
123 ·ë²Ì¤¬¤³¤ÎÉý¤è¤ê¤â¶¹¤¯¤Ê¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢
124 ÉÔ­ʬ¤¬¥¹¥Ú¡¼¥¹¤ÇËä¤á¤é¤ì¤ë
125 (º¸µÍ¤á¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ðº¸Â¦¤¬Ëä¤á¤é¤ì¤ë)¡£
126 .LP
127 .\"O Next, there may be a left precision of the form "#" followed by
128 .\"O a decimal digit string.
129 .\"O If the number of digits left of the
130 .\"O radix character is smaller than this, the representation is
131 .\"O padded on the left with the numeric fill character.
132 .\"O Grouping characters are not counted in this field width.
133 ¼¡¤Î°ÌÃ֤ˤϡ¢"#" ¤Ë 10 ¿Ê¿ôÃÍʸ»úÎó¤ò³¤±¤¿·Á¼°¤Ç¡¢
134 º¸ÀºÅÙ (left precision) ¤ò»ØÄê¤Ç¤­¤ë¡£
135 Ä̲ߤδð¿ôÅÀ (radix) ¤è¤êº¸Â¦¤Î¿ôÃͤηå¿ô¤¬¤³¤Î»ØÄê¤è¤ê¾®¤µ¤¤¾ì¹ç¤Ï¡¢
136 ¿ôÃÍËä¤áʸ»ú¤Çº¸Â¦¤¬Ëä¤á¤é¤ì¤ë¡£
137 ¤³¤Î¥Õ¥£¡¼¥ë¥ÉÉý¤Î»ØÄê¤Ç¤Ï¡¢¥°¥ë¡¼¥×²½Ê¸»ú¤Ï¥«¥¦¥ó¥È¤µ¤ì¤Ê¤¤¡£
138 .LP
139 .\"O Next, there may be a right precision of the form "." followed by
140 .\"O a decimal digit string.
141 .\"O The amount being formatted is rounded to
142 .\"O the specified number of digits prior to formatting.
143 .\"O The default is specified in the
144 .\"O .I frac_digits
145 .\"O and
146 .\"O .I int_frac_digits
147 .\"O items of the current locale.
148 .\"O If the right precision is 0, no radix character is printed.
149 .\"O (The radix character here is determined by
150 .\"O .BR LC_MONETARY ,
151 .\"O and may differ from that specified by
152 .\"O .BR LC_NUMERIC .)
153 ¼¡¤Î°ÌÃ֤ˤϡ¢"." ¤Ë 10 ¿Ê¿ôÃÍʸ»úÎó¤ò³¤±¤¿·Á¼°¤Ç¡¢
154 ±¦ÀºÅÙ (right precision) ¤ò»ØÄê¤Ç¤­¤ë¡£
155 À°·Á¤µ¤ì¤ë¿ôÃͤϡ¢À°·ÁÁ°¤Ë¤³¤Î·å¿ô¤Ë´Ý¤á¤é¤ì¤ë¡£
156 ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¥«¥ì¥ó¥È¥í¥±¡¼¥ë¤Î
157 .I frac_digits
158 ¤È
159 .I int_frac_digits
160 ¤Î»ØÄê¤òÍѤ¤¤ë¡£
161 ±¦ÀºÅÙ¤¬ 0 ¤Î¾ì¹ç¤Ï¡¢´ð¿ôÅÀʸ»ú (radix character) ¤Ï°õ»ú¤µ¤ì¤Ê¤¤
162 (¤³¤³¤Ç¤Î´ð¿ôÅÀʸ»ú¤Ï
163 .B LC_MONETARY
164 ¤ÇÄêµÁ¤µ¤ì¤Æ¤ª¤ê¡¢
165 .B LC_NUMERIC
166 ¤Î»ØÄê¤È¤Ï°Û¤Ê¤Ã¤Æ¤¤¤Æ¤â¤è¤¤)¡£
167 .LP
168 .\"O Finally, the conversion specification must be ended with a
169 .\"O conversion character.
170 .\"O The three conversion characters are
171 ºÇ¸å¤Ë¡¢ÊÑ´¹»ØÄê¤ÏÊÑ´¹Ê¸»ú (conversion character)
172 ¤Ç½ªÎ»¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
173 ÊÑ´¹Ê¸»ú¤Ë¤Ï°Ê²¼¤Î 3 ¤Ä¤¬¤¢¤ë¡£
174 .TP
175 .B %
176 .\"O (In this case the entire specification must be exactly "%%".)
177 .\"O Put a \(aq%\(aq character in the result string.
178 (¤³¤Î¾ì¹ç¤Ï»ØÄêÁ´ÂΤ¬ "%%" ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£)
179 ·ë²Ì¤Îʸ»úÎó¤Ë \(aq%\(aq Ê¸»ú¤ò½ñ¤­¤³¤à¡£
180 .TP
181 .B i
182 .\"O One argument of type
183 .\"O .I double
184 .\"O is converted using the locale's international currency format.
185 .I double
186 ·¿¤Î°ú¤­¿ô¤Ò¤È¤Ä¤¬¡¢
187 ¥í¥±¡¼¥ë¤Î¹ñºÝÄ̲ߥե©¡¼¥Þ¥Ã¥È (international currency format)
188 ¤òÍѤ¤¤ÆÊÑ´¹¤µ¤ì¤ë¡£
189 .TP
190 .B n
191 .\"O One argument of type
192 .\"O .I double
193 .\"O is converted using the locale's national currency format.
194 .I double
195 ·¿¤Î°ú¤­¿ô¤Ò¤È¤Ä¤¬¡¢
196 ¥í¥±¡¼¥ë¤Î¹ñÆâÄ̲ߥե©¡¼¥Þ¥Ã¥È (national currency format)
197 ¤òÍѤ¤¤ÆÊÑ´¹¤µ¤ì¤ë¡£
198 .\"O .SH "RETURN VALUE"
199 .SH ÊÖ¤êÃÍ
200 .\"O The
201 .\"O .BR strfmon ()
202 .\"O function returns the number of characters placed
203 .\"O in the array \fIs\fP, not including the terminating null byte,
204 .\"O provided the string, including the terminating null byte, fits.
205 .\"O Otherwise, it sets
206 .\"O .I errno
207 .\"O to
208 .\"O .BR E2BIG ,
209 .\"O returns \-1, and the contents of the array is undefined.
210 .BR strfmon ()
211 ´Ø¿ô¤Ï¡¢·ë²Ì¤Îʸ»úÎ󤬽ªÃ¼¤Î NULL ¥Ð¥¤¥È¤ò´Þ¤á¤ÆÇÛÎó
212 .I s
213 ¤Ë¼ý¤Þ¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢
214 .I s
215 ¤Ë½ñ¤­¤³¤Þ¤ì¤¿Ê¸»ú¿ô¤òÊÖ¤¹¡£NULL ¥Ð¥¤¥È¤Ïʸ»ú¿ô¤ËÆþ¤é¤Ê¤¤¡£
216 ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ë¤Ï¡¢
217 .I errno
218 ¤Ë
219 .B E2BIG
220 ¤òÀßÄꤷ¤Æ \-1 ¤òÊÖ¤¹¡£
221 ¤³¤Î¾ì¹ç¤ÎÇÛÎó¤ÎÆâÍƤÏ̤ÄêµÁ¤Ç¤¢¤ë¡£
222 .\"O .SH "CONFORMING TO"
223 .SH ½àµò
224 .\"O Not in POSIX.1-2001.
225 .\"O Present on several other systems.
226 POSIX.1-2001 ¤Ë¤Ï¤Ê¤¤¡£
227 ¾¤Î¤¤¤¯¤Ä¤«¤Î¥·¥¹¥Æ¥à¤Ë¸ºß¤¹¤ë¡£
228 .\"O .SH EXAMPLE
229 .SH Îã
230 .\"O The call
231 .in +4n
232 .nf
233
234 strfmon(buf, sizeof(buf), "[%^=*#6n] [%=*#6i]",
235         1234.567, 1234.567);
236
237 .fi
238 .in
239 ¤Î¤è¤¦¤Ê´Ø¿ô¥³¡¼¥ë¤Î½ÐÎϤϡ¢¥ª¥é¥ó¥À¤Î¥í¥±¡¼¥ë¤Ç¤Ï°Ê²¼¤Î¤è¤¦¤Ê½ÐÎϤˤʤ롣
240 .\"O outputs
241 .in +4n
242
243 [ fl **1234,57] [ NLG  **1 234,57]
244
245 .in
246 .\"O in the Dutch locale (with fl for "florijnen" and NLG for Netherlands Guilders).
247 (fl ¤Ï "florijnen" ¤Î°Õ¡£NLG ¤Ï Netherlands Guilder¡£)
248 .\"O The grouping character is very ugly because it takes as much space
249 .\"O as a digit, while it should not take more than half that,
250 .\"O and will no doubt cause confusion.
251 .\"O Surprisingly, the "fl" is preceded and followed by a space,
252 .\"O and "NLG" is preceded by one and followed by two spaces.
253 .\"O This may be a bug in the locale files.
254 .\"O The Italian, Australian, Swiss
255 .\"O and Portuguese locales yield
256 ¥°¥ë¡¼¥×²½Ê¸»ú¤òÍѤ¤¤ë¤ÈÈó¾ï¤Ë½¹¤¯¤Ê¤ë¡£
257 Ʊ»þ¤Ë´Ö°ã¤¤¤Ê¤¯º®Íð¤Î¸¶°ø¤Ë¤â¤Ê¤Ã¤Æ¤·¤Þ¤¦¤À¤í¤¦¡£
258 ¤³¤ì¤Ï¿ôÃͤÎȾʬ°Ê²¼¤ÎÉý¤Ç¤¢¤ë¤Ù¤­¤À¤¬¡¢
259 ¿ôÃͤÈƱ¤¸¤À¤±¤ÎÉý¤ò¼è¤Ã¤Æ¤·¤Þ¤¦¤«¤é¤Ç¤¢¤ë¡£
260 ¤Ò¤É¤¤¤³¤È¤Ë¡¢ "fl" ¤ÎÁ°¸å¤Ë¤Ï¥¹¥Ú¡¼¥¹¤¬Æþ¤Ã¤Æ¤·¤Þ¤¤¡¢
261 ¤Þ¤¿ "NLG" ¤ÎÁ°¤Ë¤Ï 1 ¤Ä¡¢¸å¤Ë¤Ï 2 ¤Ä¤Î¥¹¥Ú¡¼¥¹¤¬ÃÖ¤«¤ì¤Æ¤¤¤ë¡£
262 ¤³¤ì¤Ï¥í¥±¡¼¥ë¥Õ¥¡¥¤¥ë¤Î¥Ð¥°¤Ç¤¢¤í¤¦¡£
263 ¥¤¥¿¥ê¥¢¡¦¥ª¡¼¥¹¥È¥é¥ê¥¢¡¦¥¹¥¤¥¹¡¦¥Ý¥ë¥È¥¬¥ë¤Î
264 ³Æ¥í¥±¡¼¥ë¤Ç¤Î·ë²Ì¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ë¡£
265 .in +4n
266
267 [ L. **1235] [ ITL  **1.235]
268 .br
269 [ $**1234.57] [ AUD **1,234.57]
270 .br
271 [Fr. **1234,57] [CHF  **1.234,57]
272 .br
273 [ **1234$57Esc] [ **1.234$57PTE ]
274 .in
275 .\"O .SH "SEE ALSO"
276 .SH ´ØÏ¢¹àÌÜ
277 .BR setlocale (3),
278 .BR sprintf (3),
279 .BR locale (7)