[BACK]Return to strfmon.3 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / stdlib

Annotation of src/lib/libc/stdlib/strfmon.3, Revision 1.5.18.1

1.5.18.1! martin      1: .\"    $NetBSD: strfmon.3,v 1.5 2014/03/18 18:20:37 riastradh Exp $
1.1       christos    2: .\"
                      3: .\" Copyright (c) 2001 Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org>
                      4: .\" All rights reserved.
                      5: .\"
                      6: .\" Redistribution and use in source and binary forms, with or without
                      7: .\" modification, are permitted provided that the following conditions
                      8: .\" are met:
                      9: .\" 1. Redistributions of source code must retain the above copyright
                     10: .\"    notice, this list of conditions and the following disclaimer.
                     11: .\" 2. Redistributions in binary form must reproduce the above copyright
                     12: .\"    notice, this list of conditions and the following disclaimer in the
                     13: .\"    documentation and/or other materials provided with the distribution.
                     14: .\"
                     15: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     16: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     17: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     18: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     19: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     20: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     21: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     22: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     23: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     24: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     25: .\" SUCH DAMAGE.
                     26: .\"
                     27: .\"    From: FreeBSD: Id: strfmon.3,v 1.7 2003/01/06 06:21:25 tjr Exp
                     28: .\"
1.5.18.1! martin     29: .Dd August 15, 2017
1.1       christos   30: .Dt STRFMON 3
                     31: .Os
                     32: .Sh NAME
                     33: .Nm strfmon
                     34: .Nd convert monetary value to string
                     35: .Sh LIBRARY
                     36: .Lb libc
                     37: .Sh SYNOPSIS
                     38: .In monetary.h
                     39: .Ft ssize_t
                     40: .Fn strfmon "char * restrict s" "size_t maxsize" "const char * restrict format" "..."
1.5.18.1! martin     41: .Ft ssize_t
        !            42: .Fn strfmon_l "char * restrict s" "size_t maxsize" "locale_t loc" "const char * restrict format" "..."
1.1       christos   43: .Sh DESCRIPTION
                     44: The
                     45: .Fn strfmon
                     46: function places characters into the array pointed to by
                     47: .Fa s
                     48: as controlled by the string pointed to by
                     49: .Fa format .
                     50: No more than
                     51: .Fa maxsize
                     52: bytes are placed into the array.
                     53: .Pp
1.5.18.1! martin     54: The
        !            55: .Fn strfmon_l
        !            56: function behaves the same as
        !            57: .Fn strfmon ,
        !            58: but uses the locale
        !            59: .Fa loc
        !            60: instead of the process global locale.
        !            61: .Pp
1.1       christos   62: The format string is composed of zero or more directives:
                     63: ordinary characters (not
                     64: .Cm % ) ,
                     65: which are copied unchanged to the output stream; and conversion
                     66: specifications, each of which results in fetching zero or more subsequent
                     67: arguments.
                     68: Each conversion specification is introduced by the
                     69: .Cm %
                     70: character.
                     71: After the
                     72: .Cm % ,
                     73: the following appear in sequence:
                     74: .Bl -bullet
                     75: .It
                     76: Zero or more of the following flags:
                     77: .Bl -tag -width "XXX"
                     78: .It Cm = Ns Ar f
                     79: A
                     80: .Sq Cm =
                     81: character followed by another character
                     82: .Ar f
                     83: which is used as the numeric fill character.
                     84: .It Cm ^
                     85: Do not use grouping characters, regardless of the current locale default.
                     86: .It Cm +
                     87: Represent positive values by prefixing them with a positive sign,
                     88: and negative values by prefixing them with a negative sign.
                     89: This is the default.
                     90: .It Cm \&(
                     91: Enclose negative values in parentheses.
                     92: .It Cm \&!
                     93: Do not include a currency symbol in the output.
                     94: .It Cm \-
                     95: Left justify the result.
                     96: Only valid when a field width is specified.
                     97: .El
                     98: .It
                     99: An optional minimum field width as a decimal number.
                    100: By default, there is no minimum width.
                    101: .It
                    102: A
                    103: .Sq Cm #
                    104: sign followed by a decimal number specifying the maximum
                    105: expected number of digits after the radix character.
                    106: .It
                    107: A
                    108: .Sq Cm \&.
                    109: character followed by a decimal number specifying the number
1.3       wiz       110: of digits after the radix character.
1.1       christos  111: .It
                    112: One of the following conversion specifiers:
                    113: .Bl -tag -width "XXX"
                    114: .It Cm i
                    115: The
                    116: .Vt double
                    117: argument is formatted as an international monetary amount.
                    118: .It Cm n
                    119: The
                    120: .Vt double
                    121: argument is formatted as a national monetary amount.
                    122: .It Cm %
                    123: A
                    124: .Sq Li %
                    125: character is written.
                    126: .El
                    127: .El
                    128: .Sh RETURN VALUES
                    129: If the total number of resulting bytes including the terminating
                    130: .Dv NULL
                    131: byte is not more than
                    132: .Fa maxsize ,
                    133: .Fn strfmon
                    134: returns the number of bytes placed into the array pointed to by
                    135: .Fa s ,
                    136: not including the terminating
                    137: .Dv NULL
                    138: byte.
                    139: Otherwise, \-1 is returned,
                    140: the contents of the array are indeterminate,
                    141: and
                    142: .Va errno
                    143: is set to indicate the error.
                    144: .Sh ERRORS
                    145: The
                    146: .Fn strfmon
                    147: function will fail if:
                    148: .Bl -tag -width Er
                    149: .It Bq Er E2BIG
                    150: Conversion stopped due to lack of space in the buffer.
                    151: .It Bq Er EINVAL
                    152: The format string is invalid.
                    153: .It Bq Er ENOMEM
                    154: Not enough memory for temporary buffers.
                    155: .El
                    156: .Sh SEE ALSO
                    157: .Xr localeconv 3
                    158: .Sh STANDARDS
                    159: The
                    160: .Fn strfmon
                    161: function
                    162: conforms to
                    163: .St -p1003.1-2001 .
                    164: .Sh AUTHORS
                    165: .An -nosplit
                    166: The
                    167: .Fn strfmon
                    168: function was implemented by
1.4       wiz       169: .An Alexey Zelkin Aq Mt phantom@FreeBSD.org .
1.1       christos  170: .Pp
                    171: This manual page was written by
1.4       wiz       172: .An Jeroen Ruigrok van der Werven Aq Mt asmodai@FreeBSD.org
1.3       wiz       173: based on the standard's text.
1.1       christos  174: .Sh BUGS
                    175: The
                    176: .Fn strfmon
                    177: function does not correctly handle multibyte characters in the
                    178: .Fa format
                    179: argument.

CVSweb <webmaster@jp.NetBSD.org>