Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ localeconv(3c) — NEWS-os 5.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

setlocale(3C)

chrtbl(1M)

montbl(1M)



localeconv(3C)          LIBRARY FUNCTIONS          localeconv(3C)



NAME
     localeconv - get numeric formatting information

SYNOPSIS
     #include <locale.h>

     struct lconv *localeconv (void);

DESCRIPTION
     localeconv sets the components of an object with type struct
     lconv  (defined in locale.h) with the values appropriate for
     the formatting of numeric quantities  (monetary  and  other-
     wise)  according  to  the  rules  of the current locale [see
     setlocale(3C)]. The definition  of  struct  lconv  is  given
     below (the values for the fields in the "C" locale are given
     in comments):

          char *decimalpoint;          /* "." */
          char *thousandssep;          /* "" (zero length string) */
          char *grouping;               /* "" */
          char *intcurrsymbol;   /* "" */
          char *currencysymbol;   /* "" */
          char *mondecimalpoint; /* "" */
          char *monthousandssep;      /* "" */
          char *mongrouping;      /* "" */
          char *positivesign;          /* "" */
          char *negativesign;          /* "" */
          char intfracdigits;         /* CHARMAX */
          char fracdigits;        /* CHARMAX */
          char pcsprecedes;      /* CHARMAX */
          char psepbyspace;          /* CHARMAX */
          char ncsprecedes;      /* CHARMAX */
          char nsepbyspace;          /* CHARMAX */
          char psignposn;        /* CHARMAX */
          char nsignposn;        /* CHARMAX */

     The members of the structure with type char *  are  strings,
     any  of  which  (except  decimalpoint)  can point to "", to
     indicate that the value is  not  available  in  the  current
     locale or is of zero length.  The members with type char are
     nonnegative numbers, any of which can be  CHARMAX  (defined
     in  the  limits.h header file) to indicate that the value is
     not available in the current locale.  The  members  are  the
     following:

     char *decimalpoint
          The decimal-point character used to format non-monetary
          quantities.

     char *thousandssep
          The character used to separate groups of digits to  the
          left  of  the decimal-point character in formatted non-



                                                                1





localeconv(3C)          LIBRARY FUNCTIONS          localeconv(3C)



          monetary quantities.

     char *grouping
          A string in which each element is taken as  an  integer
          that  indicates  the number of digits that comprise the
          current group in  a  formatted  non-monetary  quantity.
          The  elements  of grouping are interpreted according to
          the following:

          CHAR-MAX         No further  grouping  is  to  be  per-
                           formed.

          0                The previous element is to be  repeat-
                           edly  used  for  the  remainder of the
                           digits.

          other            The value is the number of digits that
                           comprise  the current group.  The next
                           element is examined to  determine  the
                           size  of  the  next group of digits to
                           the left of the current group.

     char *intcurrsymbol
            The international currency symbol applicable  to  the
            current   locale,   left-justified   within  a  four-
            character   space-padded   field.    The    character
            sequences  should match with those specified in:  ISO
            4217 Codes for the  Representation  of  Currency  and
            Funds.

     char *currencysymbol
            The local currency symbol applicable to  the  current
            locale.

     char *mondecimalpoint
            The decimal-point used to format monetary quantities.

     char *monthousandssep
            The separator for groups of digits to the left of the
            decimal-point in formatted monetary quantities.

     char *mongrouping
            A string in which each element is taken as an integer
            that indicates the number of digits that comprise the
            current group in a formatted monetary quantity.   The
            elements of mongrouping are interpreted according to
            the rules described under grouping.

     char *positivesign
            The string used to indicate a nonnegative-valued for-
            matted monetary quantity.




                                                                2





localeconv(3C)          LIBRARY FUNCTIONS          localeconv(3C)



     char *negativesign
            The string used to indicate a negative-valued format-
            ted monetary quantity.

     char intfracdigits
            The number of fractional digits (those to  the  right
            of  the decimal-point) to be displayed in an interna-
            tionally formatted monetary quantity.

     char fracdigits
            The number of fractional digits (those to  the  right
            of  the decimal-point) to be displayed in a formatted
            monetary quantity.

     char pcsprecedes
            Set to 1 or 0  if  the  currencysymbol  respectively
            precedes or succeeds the value for a nonnegative for-
            matted monetary quantity.

     char psepbyspace
            Set to 1 or 0 if the currencysymbol respectively  is
            or  is  not separated by a space from the value for a
            nonnegative formatted monetary quantity.

     char ncsprecedes
            Set to 1 or 0  if  the  currencysymbol  respectively
            precedes or succeeds the value for a negative format-
            ted monetary quantity.

     char nsepbyspace
            Set to 1 or 0 if the currencysymbol respectively  is
            or  is  not separated by a space from the value for a
            negative formatted monetary quantity.

     char psignposn
            Set to a value  indicating  the  positioning  of  the
            positivesign  for  a  nonnegative formatted monetary
            quantity.  The value of  psignposn  is  interpreted
            according to the following:

            0    Parentheses   surround    the    quantity    and
                 currencysymbol.

            1    The  sign  string  precedes  the  quantity   and
                 currencysymbol.

            2    The  sign  string  succeeds  the  quantity   and
                 currencysymbol.

            3    The  sign  string   immediately   precedes   the
                 currencysymbol.




                                                                3





localeconv(3C)          LIBRARY FUNCTIONS          localeconv(3C)



            4    The  sign  string   immediately   succeeds   the
                 currencysymbol.

     char nsignposn
            Set to a value  indicating  the  positioning  of  the
            negativesign for a negative formatted monetary quan-
            tity.   The  value  of  nsignposn  is   interpreted
            according to the rules described under psignposn.

RETURNS
     localeconv returns a pointer to the filled-in  object.   The
     structure  pointed to by the return value may be overwritten
     by a subsequent call to localeconv.

EXAMPLES
     The following table illustrates the rules used by four coun-
     tries to format monetary quantities.

       Country    Positive format       Negative formatInternational format

       Italy      L.1.234    -L.1.234   ITL.1.234
       Netherlands           F 1.234,56 F -1.234,56NLG 1.234,56
       Norway     kr1.234,56 kr1.234,56-NOK 1.234,56
       Switzerland           SFrs.1,234.56SFrs.1,234.56CCHF 1,234.56

     For these four countries,  the  respective  values  for  the
     monetary members of the structure returned by localeconv are
     as follows:

                     Italy Netherlands        NorwaySwitzerland

       intcurrsymbol     "ITL."    "NLG "   "NOK ""CHF "
       currencysymbol     "L."      "F"      "kr""SFrs."
       mondecimalpoint   ""        ","      ",""."
       monthousandssep   "."       "."      "."","
       mongrouping  "\3"  "\3"      "\3"     "\3"
       positivesign ""    ""        ""       ""
       negativesign "-"   "-"       "-"      "C"
       intfracdigits     0         2        22
       fracdigits   0     2         2        2
       pcsprecedes 1     1         1        1
       psepbyspace      0         1        00
       ncsprecedes 1     1         1        1
       nsepbyspace      0         1        00
       psignposn   1     1         1        1
       nsignposn   1     4         2        2

FILES
     /usr/lib/locale/locale/LCMONETARY  -  LC_MONETARY  database
     for locale.
     /usr/lib/locale/locale/LCNUMERIC - LC_NUMERIC database  for
     locale.



                                                                4





localeconv(3C)          LIBRARY FUNCTIONS          localeconv(3C)



SEE ALSO
     setlocale(3C).
     chrtbl(1M), montbl(1M) in the System Administrator's  Refer-
     ence Manual.



















































                                                                5



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026