]>
Commit | Line | Data |
---|---|---|
1f2f436a A |
1 | --- strfmon.3.orig 2010-02-08 16:26:10.000000000 -0800 |
2 | +++ strfmon.3 2010-02-08 17:57:07.000000000 -0800 | |
b5d655f7 | 3 | @@ -30,25 +30,49 @@ |
3d9156a7 A |
4 | .Dt STRFMON 3 |
5 | .Os | |
6 | .Sh NAME | |
7 | -.Nm strfmon | |
8 | +.Nm strfmon , | |
9 | +.Nm strfmon_l | |
10 | .Nd convert monetary value to string | |
b5d655f7 A |
11 | -.Sh LIBRARY |
12 | -.Lb libc | |
13 | +.\" .Sh LIBRARY | |
14 | +.\" .Lb libc | |
9385eb3d A |
15 | .Sh SYNOPSIS |
16 | .In monetary.h | |
17 | .Ft ssize_t | |
18 | -.Fn strfmon "char * restrict s" "size_t maxsize" "const char * restrict format" "..." | |
224c7076 A |
19 | +.Fo strfmon |
20 | +.Fa "char *restrict s" | |
21 | +.Fa "size_t maxsize" | |
22 | +.Fa "const char *restrict format" | |
23 | +.Fa "..." | |
24 | +.Fc | |
25 | +.In monetary.h | |
3d9156a7 A |
26 | +.In xlocale.h |
27 | +.Ft ssize_t | |
224c7076 A |
28 | +.Fo strfmon_l |
29 | +.Fa "char *restrict s" | |
30 | +.Fa "size_t maxsize" | |
31 | +.Fa "locale_t loc" | |
32 | +.Fa "const char *restrict format" | |
33 | +.Fa "..." | |
34 | +.Fc | |
9385eb3d A |
35 | .Sh DESCRIPTION |
36 | The | |
37 | .Fn strfmon | |
224c7076 A |
38 | function places characters into the array pointed to by |
39 | -.Fa s | |
40 | +.Fa s , | |
41 | as controlled by the string pointed to by | |
42 | .Fa format . | |
43 | No more than | |
3d9156a7 A |
44 | .Fa maxsize |
45 | bytes are placed into the array. | |
46 | .Pp | |
47 | +While the | |
48 | +.Fn strfmon | |
49 | +function uses the current locale, the | |
50 | +.Fn strfmon_l | |
51 | +function may be passed a locale directly. See | |
52 | +.Xr xlocale 3 | |
53 | +for more information. | |
54 | +.Pp | |
55 | The format string is composed of zero or more directives: | |
56 | ordinary characters (not | |
57 | .Cm % ) , | |
1f2f436a | 58 | @@ -116,9 +140,9 @@ character is written. |
224c7076 A |
59 | .El |
60 | .El | |
61 | .Sh RETURN VALUES | |
62 | -If the total number of resulting bytes including the terminating | |
63 | +If the total number of resulting bytes, including the terminating | |
64 | .Dv NULL | |
65 | -byte is not more than | |
66 | +byte, is not more than | |
67 | .Fa maxsize , | |
68 | .Fn strfmon | |
69 | returns the number of bytes placed into the array pointed to by | |
1f2f436a A |
70 | @@ -143,8 +167,23 @@ The format string is invalid. |
71 | .It Bq Er ENOMEM | |
3d9156a7 A |
72 | Not enough memory for temporary buffers. |
73 | .El | |
1f2f436a A |
74 | +.Sh EXAMPLE |
75 | +.Bd -literal -offset indent -compact | |
76 | + #include <stdio.h> | |
77 | + #include <monetary.h> | |
78 | + #include <locale.h> | |
79 | + | |
80 | + int main() { | |
81 | + char buf[200]; | |
82 | + setlocale(LC_ALL, "en_US"); | |
83 | + (void)strfmon (buf, sizeof(buf)-1, "%n" , 123456.78); | |
84 | + printf("%s\n", buf); | |
85 | + } | |
86 | +.Ed | |
87 | +.Pp | |
3d9156a7 A |
88 | .Sh SEE ALSO |
89 | -.Xr localeconv 3 | |
90 | +.Xr localeconv 3 , | |
91 | +.Xr xlocale 3 | |
92 | .Sh STANDARDS | |
93 | The | |
94 | .Fn strfmon |