.Dt STRFMON 3
.Os
.Sh NAME
-.Nm strfmon
+.Nm strfmon ,
+.Nm strfmon_l
.Nd convert monetary value to string
-.Sh LIBRARY
-.Lb libc
+.\" .Sh LIBRARY
+.\" .Lb libc
.Sh SYNOPSIS
.In monetary.h
.Ft ssize_t
-.Fn strfmon "char * restrict s" "size_t maxsize" "const char * restrict format" "..."
+.Fo strfmon
+.Fa "char *restrict s"
+.Fa "size_t maxsize"
+.Fa "const char *restrict format"
+.Fa "..."
+.Fc
+.In monetary.h
+.In xlocale.h
+.Ft ssize_t
+.Fo strfmon_l
+.Fa "char *restrict s"
+.Fa "size_t maxsize"
+.Fa "locale_t loc"
+.Fa "const char *restrict format"
+.Fa "..."
+.Fc
.Sh DESCRIPTION
The
.Fn strfmon
function places characters into the array pointed to by
-.Fa s
+.Fa s ,
as controlled by the string pointed to by
.Fa format .
No more than
.Fa maxsize
bytes are placed into the array.
.Pp
+While the
+.Fn strfmon
+function uses the current locale, the
+.Fn strfmon_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
+.Pp
The format string is composed of zero or more directives:
ordinary characters (not
.Cm % ) ,
.El
.El
.Sh RETURN VALUES
-If the total number of resulting bytes including the terminating
+If the total number of resulting bytes, including the terminating
.Dv NULL
-byte is not more than
+byte, is not more than
.Fa maxsize ,
.Fn strfmon
returns the number of bytes placed into the array pointed to by
.It Bq Er ENOMEM
Not enough memory for temporary buffers.
.El
+.Sh EXAMPLE
+.Bd -literal -offset indent -compact
+ #include <stdio.h>
+ #include <monetary.h>
+ #include <locale.h>
+
+ int main() {
+ char buf[200];
+ setlocale(LC_ALL, "en_US");
+ (void)strfmon (buf, sizeof(buf)-1, "%n" , 123456.78);
+ printf("%s\n", buf);
+ }
+.Ed
+.Pp
.Sh SEE ALSO
-.Xr localeconv 3
+.Xr localeconv 3 ,
+.Xr xlocale 3
.Sh STANDARDS
The
.Fn strfmon