Print this page
Additional man fixes.
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man3c/strfmon.3c
+++ new/usr/src/man/man3c/strfmon.3c
1 1 .\"
2 2 .\" This file and its contents are supplied under the terms of the
3 3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 4 .\" You may only use this file in accordance with the terms of version
5 5 .\" 1.0 of the CDDL.
6 6 .\"
7 7 .\" A full copy of the text of the CDDL should have accompanied this
8 8 .\" source. A copy of the CDDL is also available via the Internet at
9 9 .\" http://www.illumos.org/license/CDDL.
10 10 .\"
11 11 .\"
12 12 .\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
13 13 .\"
14 14 .TH STRFMON 3C "Jun 23, 2014"
15 15 .SH NAME
16 16 strfmon, strfmon_l \- convert monetary values to string
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 .SH SYNOPSIS
18 18 .LP
19 19 .nf
20 20 #include <monetary.h>
21 21
22 22 \fBssize_t\fR \fBstrfmon\fR(\fBchar *restrict\fR \fIs\fR, \fBsize_t\fR \fImaxsize\fR,
23 23 \fBconst char *restrict\fR \fIformat\fR, ...);
24 24 .fi
25 25 .LP
26 26 .nf
27 -\fBssize_t\fR \fBstrfmon\fR(\fBchar *restrict\fR \fIs\fR, \fBsize_t\fR \fImaxsize\fR,
27 +\fBssize_t\fR \fBstrfmon_l\fR(\fBchar *restrict\fR \fIs\fR, \fBsize_t\fR \fImaxsize\fR,
28 28 \fBlocale_t\fR \fIloc\fR, \fBconst char *restrict\fR \fIformat\fR, ...);
29 29 .fi
30 30 .SH DESCRIPTION
31 31 These functions are used to format strings containing numeric quantities using
32 32 rules that are specific to a given locale. For example, in the United States,
33 33 currencies are formatted using the dollar sign
34 34 .RB ( $ )
35 35 and include two decimal digits (cents).
36 36 .LP
37 37 Each character from the
38 38 .I format
39 39 is copied to the output buffer supplied by
40 40 .IR s .
41 41 Furthermore, when a percent
42 42 .RB ( % )
43 43 character is encountered, this triggers an expansion, as follows:
44 44 .LP
45 45 Immediately following the
46 46 .B %
47 47 character there shall be zero or more flags, as indicated below:
48 48 .TP
49 49 .BI = f
50 50 An equals sign followed by a character
51 51 .I f
52 52 is the numeric fill
53 53 character, which must be a single byte. The default fill character is <space>.
54 54 .TP
55 55 .B ^
56 56 The carat suppresses the use of grouping characters, even if the
57 57 locale indicates their use.
58 58 .TP
59 59 .B +
60 60 The plus sign indicates that positive and negative numbers should use the
61 61 locale's positive and negative signs. This may not be used with the open
62 62 parenthesis. This behavior is default.
63 63 .TP
64 64 .B (
65 65 The open parenthesis indicates that negative numbers should be enclosed
66 66 within parenthesis, and no special formatting should be applied to positive
67 67 values. This may not be supplied with the plus sign flag.
68 68 .TP
69 69 .B !
70 70 The exclamation point suppresses the output of any currency symbol.
71 71 .TP
72 72 .B -
73 73 The dash specifies that numeric values should be left-justified
74 74 within a field width, if a field width is specified.
75 75 .LP
76 76 Next there may appear an optional minimum field width, specified as a string of
77 77 decimal digits, indicating a minimum width in bytes of this fields.
78 78 .LP
79 79 Next there may appear a left precision, as
80 80 .RI # p ,
81 81 indicating the maximum
82 82 number of digits expected to appear left of the radix character. (If a numeric
83 83 value does not require this many places, including grouping separators, then
84 84 the numeric fill character is used to pad the value to this many places.)
85 85 .LP
86 86 Next there may appear a right precision, as
87 87 .RI . p ,
88 88 indicating the minimum
89 89 number of digits to appear to to the right of the radix character. If the
90 90 value of
91 91 .I p
92 92 is zero, then the radix character is also suppressed.
93 93 .LP
94 94 Finally there shall appear one of the following conversion specifier
95 95 characters:
96 96 .TP
97 97 .B i
98 98 The next available argument (assumed to be
99 99 .BR double )
100 100 is formatted, using
101 101 the locale's international currency format. For example, in the United States,
102 102 the output might look like "USD 1,234.56".
103 103 .TP
104 104 .B n
105 105 The next available argument (assumed to be
106 106 .BR double )
107 107 is formatted, using
108 108 the locale's national currency format. For example, in the United States, the
109 109 output might look like "$1,234.56".
110 110 .TP
111 111 .B %
112 112 A single percent character is emitted. In this case, the entire specifier
113 113 shall be
114 114 .BR %% .
115 115 .LP
116 116 Whereas the
117 117 .B strfmon()
118 118 function uses the current locale, the
119 119 .B strfmon_l()
120 120 function uses the supplied locale
121 121 .IR loc .
122 122 .SH RETURN VALUES
123 123 .LP
124 124 If the conversion was successfully performed, and the entire result (including
125 125 the terminating null character) fits in
126 126 .I maxsize
127 127 bytes, then the number of
128 128 bytes placed in the buffer (excluding the terminating null character) is
129 129 returned.
130 130 .LP
131 131 If the result of expansion exceeds
132 132 .I maxsize
133 133 bytes, then the value \(mi1 is returned, and
134 134 .I errno
135 135 is set to
136 136 .BR E2BIG .
137 137 .SH NOTES
138 138 The result of formatting a value that is not a rational number (e.g. +NaN) is
139 139 unspecified.
140 140 .SH ATTRIBUTES
141 141 .LP
142 142 See
143 143 .BR attributes (5)
144 144 for descriptions of the following attributes:
145 145 .TS
146 146 box;
147 147 c | c
148 148 l | l .
149 149 ATTRIBUTE TYPE ATTRIBUTE VALUE
150 150 _
151 151 CSI Enabled
152 152 _
153 153 Interface Stability Standard
154 154 _
155 155 MT-Level MT-Safe
156 156 .TE
157 157
158 158 .SH SEE ALSO
159 159 .BR setlocale (3C),
160 160 .BR uselocale (3C),
161 161 .BR locale (3HEAD),
162 162 .BR attributes (5),
163 163 .BR standards (5)
164 164
↓ open down ↓ |
127 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX