Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ locale(3C) — sys5 — Apollo Domain/OS SR10.3.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ctime(3C)

ctype(3C)

string(3C)

locale(4)

LOCALE(3C)                           SysV                           LOCALE(3C)



NAME
     locale - set or get locale or numerical formatting information

SYNOPSIS
     #include <locale.h>

     char *setlocale(category, locale)
     int category;
     const char *locale;

     struct lconv *localeconv(void)

DESCRIPTION
     The setlocale function sets part or all of the program's locale, as
     specified by the category and locale arguments.

     The category argument specifies the portion of the program's locale
     affected by the setlocale call, as follows:

     LC_ALL        Names the program's entire locale.

     LC_COLLATE    Affects the behavior of the strcoll and strxfrm functions
                   (see string(3C)).

     LC_CTYPE      Affects the behavior of the character handling functions
                   and the multibyte functions, except isdigit and isxdigit
                   (see ctype(3C)).

     LC_MONETARY   Affects the monetary formatting information returned by
                   localeconv.

     LC_NUMERIC    Affects the decimal-point character for formatted
                   input/output functions and the string conversion functions
                   (see printf(3S) and string(3C)), as well as the non-
                   monetary formatting information returned by localeconv.

     LC_TIME       Affects the behavior of the strftime function (see
                   ctime(3C)).

     The locale argument specifies the locale selected by the program.  The
     only supported locale is the C locale, which selects the ANSI C defined
     minimum environment for C translation.

     The localeconv function returns a pointer to a lconv structure filled in
     with information appropriate to the currently set locale.  The lconv
     structure contains the following members specifying how monetary and
     non-monetary values are formatted for a given locale:

     struct lconv {
         char    *int_curr_symbol;      /* international currency sym. */
         char    *currency_symbol;      /* (local) currency sym. */
         char    *mon_decimal_point;    /* monetary decimal point */
         char    *mon_thousands_sep;    /* monetary thousands separator */
         char    *mon_grouping;         /* monetary grouping */
         char    *positive_sign;        /* positive sign */
         char    *negative_sign;        /* negative sign */
         char    int_frac_digits;       /* international fractional digits */
         char    frac_digits;           /* fractional digits */
         char    p_cs_precedes;         /* pos. currency sym. preceeds */
         char    p_sep_by_space;        /* pos. currency sym. sep. by space */
         char    p_sign_posn;           /* pos. sign position */
         char    n_cs_precedes;         /* neg. currency sym. preceeds */
         char    n_sep_by_space;        /* neg. currency sym. sep. by space */
         char    n_sign_posn;           /* neg. sign position */
         char    *decimal_point;        /* decimal point (aka RADIXCHAR) */
         char    *thousands_sep;        /* thousands separator */
         char    *grouping;             /* grouping */
     };

     The values of the lconv structure returned for the C locale are as shown:

     static struct lconv __C_lconv = {
         "",          /* international currency sym. */
         "",          /* (local) currency sym. */
         "",          /* monetary decimal point. */
         "",          /* monetary thousands separator. */
         "",          /* monetary grouping. */
         "",          /* positive sign. */
         "",          /* negative sign. */
         CHAR_MAX,    /* international fractional digits. */
         CHAR_MAX,    /* fractional digits. */
         CHAR_MAX,    /* pos. currency sym. preceeds. */
         CHAR_MAX,    /* pos. currency sym. sep. by space. */
         CHAR_MAX,    /* pos. sign position. */
         CHAR_MAX,    /* neg. currency sym. preceeds. */
         CHAR_MAX,    /* neg. currency sym. sep. by space. */
         CHAR_MAX,    /* neg. sign position. */
         ".",         /* decimal point (aka RADIXCHAR). */
         "",          /* thousands separator. */
         ""           /* grouping. */
     };

SEE ALSO
     ctime(3C), ctype(3C), printf (3S), string(3C), locale(4).

DIAGNOSTICS
     setlocale returns a pointer to a string containing the currently set
     locale.

     localeconv returns a pointer to a lconv structure filled in with values
     appropriate for the currently set locale.

NOTE
     Parts of this discussion are adapted from ANS X3.159-1989.

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