Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ctime(3)



  setlocale(3)                        CLIX                        setlocale(3)



  NAME

    setlocale - Sets the locale of the process

  LIBRARY

    Standard C Library (libc.a)

  SYNOPSIS

    #include <locale.h>

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

  PARAMETERS

    category   Specifies the locale control category (LC_*) to set or show.

    locale     Specifies the value or action to be applied to category.

  DESCRIPTION

    The setlocale() function sets, changes, or shows the locale of the process
    according to the values of the category and the locale parameters.

    The category parameter specifies to the locale control category (LC_*) to
    set or show.  The possible values for the category parameter and their
    descriptions are as follows:

    LC_CTYPE      Affects the behavior of character handling functions and
                  multibyte functions in the locale.

    LC_COLLATE    Affects the sorting order of characters in the locale.

    LC_TIME       Affects the time and date format in the locale.

    LC_NUMERIC    Affects the decimal-point character for the formatted
                  input/output functions as well as the string conversion
                  functions.

    LC_MONETARY   Affects monetary formatting information for the locale.

    For POSIX-compliant systems, environment variables are defined that
    correspond to the named categories above and that have the same spelling.

    The value LC_ALL for category names all of the categories of the locale of
    the process;  LC_ALL is a special constant, not a category. There is an
    environment variable LC_ALL, which is described below.




  2/94 - Intergraph Corporation                                              1






  setlocale(3)                        CLIX                        setlocale(3)



    The locale parameter is a pointer to a character string that can be the
    string C, a NULL pointer, or a null string.

    A value of C specifies the minimal environment for C-language translation.
    If setlocale() is not invoked, the C locale will be the locale of the
    process.

    When locale is a NULL pointer, the local of the process is queried
    according to the value of category.  The content of the string returned is
    C.

    When locale is a null string, the setlocale() function takes the name of
    the new locale for the specified category from the environment as
    determined by the first condition met in the following list:

    1.  If LC_ALL is defined in the environment and is not null, the value of
        LC_ALL is used.

    2.  If there is a variable defined in the environment with the same name
        as the category and is not null, the value specified by that
        environment variable is used.

    3.  If LANG is defined in the environment and is not null, the value of
        LANG is used.

    If the resulting value is a supported locale, setlocale() sets the
    specified category of the locale of the process to that value and returns
    the value specified in the RETURN VALUES section.  If the value does not
    name a supported locale and is not null, setlocale() returns a NULL
    pointer, and the locale of the process is not changed by the function
    call.  If no non-null environment variable is present to supply a value,
    setlocale() sets the specified category of the locale of the process to C.

    At program startup, all categories are set to C.  This is the same as
    invoking setlocale() as follows:

    setlocale(LC_ALL, "C");


    Setting all of the categories of the locale of the process is similar to
    successively setting each individual category, except that all error
    checking is done before any actions are performed.  To set all the
    categories of the locale of the process, setlocale() is invoked as
    follows:

    setlocale(LC_ALL, "");


    In this case, setlocale() first verifies that the values of all the
    environment variables it needs indicate supported locales.  If the value
    of any of the environment variable searches yields a locale that is not



  2                                              Intergraph Corporation - 2/94






  setlocale(3)                        CLIX                        setlocale(3)



    supported (and non-null) the setlocale() function returns a NULL pointer
    and the locale of the process is not changed.  If all environment
    variables name supported locales, setlocale() then proceeds as if it had
    been called for each category, using the appropriate value form the
    associated environment variable, or from the default if there is no such
    value.

  NOTES

    This implementation currently supports only the C locale.

  RETURN VALUES

    If successful, setlocale() returns the string C.  Otherwise, the function
    returns a null pointer, and the locale is not changed.

  RELATED INFORMATION

    Functions: ctime(3)



































  2/94 - Intergraph Corporation                                              3




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