SETLOCALE(3C-SVR4) RISC/os Reference Manual SETLOCALE(3C-SVR4)
NAME
setlocale - modify and query a program's locale
SYNOPSIS
#include <locale.h>
char *setlocale (int category, const char *locale);
DESCRIPTION
setlocale selects the appropriate piece of the program's
locale as specified by the category and locale arguments.
The category argument may have the following values:
LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY,
LC_MESSAGES and LC_ALL. These names are defined in the
locale.h header file. LC_CTYPE affects the behavior of the
character handling functions (isdigit, tolower, etc.) and
the multibyte character functions (such as mbtowc and
wctomb). LC_NUMERIC affects the decimal-point character for
the formatted input/output functions and the string conver-
sion functions as well as the non-monetary formatting infor-
mation returned by localeconv. [See localeconv(3C).].
LC_TIME affects the behavior of ascftime, cftime, getdate
and strftime. LC_COLLATE affects the behavior of strcoll
and strxfrm. LC_MONETARY affects the monetary formatted
information returned by localeconv. LC_MESSAGES affects the
behavior of gettxt, catopen, catclose, and catgets. [See
catopen(3C) and catgets(3C).] LC_ALL names the program's
entire locale.
Each category corresponds to a set of databases which con-
tain the relevant information for each defined locale. The
location of a database is given by the following path,
/<systype>/usr/lib/locale/locale/category, where locale and
category are the names of locale and category, respectively.
For example, the database for the LC_CTYPE category for the
german locale would be found in
/<systype>/usr/lib/locale/german/LC_CTYPE.
A value of "C" for locale specifies the default environment.
A value of "" for locale specifies that the locale should be
taken from environment variables. The order in which the
environment variables are checked for the various categories
is given below:
Category 1st Env. Var. 2nd Env. Var
___________________________________________
LC_CTYPE: LC_CTYPE LANG
LC_COLLATE: LC_COLLATE LANG
LC_TIME: LC_TIME LANG
LC_NUMERIC: LC_NUMERIC LANG
LC_MONETARY: LC_MONETARY LANG
Printed 11/19/92 Page 1
SETLOCALE(3C-SVR4) RISC/os Reference Manual SETLOCALE(3C-SVR4)
LC_MESSAGES: LC_MESSAGES LANG
At program startup, the equivalent of
setlocale(LC_ALL, "C")
is executed. This has the effect of initializing each
category to the locale described by the environment "C".
If a pointer to a string is given for locale, setlocale
attempts to set the locale for the given category to locale.
If setlocale succeeds, locale is returned. If setlocale
fails, a null pointer is returned and the program's locale
is not changed.
For category LC_ALL, the behavior is slightly different. If
a pointer to a string is given for locale and LC_ALL is
given for category, setlocale attempts to set the locale for
all the categories to locale. The locale may be a simple
locale, consisting of a single locale, or a composite
locale. A composite locale is a string beginning with a "/"
followed by the locale of each category separated by a "/".
If setlocale fails to set the locale for any category, a
null pointer is returned and the program's locale for all
categories is not changed. Otherwise, locale is returned.
A null pointer for locale causes setlocale to return the
current locale associated with the category. The program's
locale is not changed.
FILES
/<systype>/usr/lib/locale/C/LC_CTYPE
LC_CTYPE database for the C locale.
/<systype>/usr/lib/locale/C/LC_NUMERIC
LC_NUMERIC database for the C
locale.
/<systype>/usr/lib/locale/C/LC_TIME
LC_TIME database for the C locale.
/<systype>/usr/lib/locale/C/LC_COLLATE
LC_COLLATE database for the C
locale.
/<systype>/usr/lib/locale/C/LC_MESSAGES
LC_MESSAGES database for the C
locale.
/<systype>/usr/lib/locale/<locale>/category
files containing the locale
specific information for each
Page 2 Printed 11/19/92
SETLOCALE(3C-SVR4) RISC/os Reference Manual SETLOCALE(3C-SVR4)
locale and category.
SEE ALSO
ctime(3C-SVR4), ctype(3C-SVR4), getdate(3C-SVR4),
gettxt(3C-SVR4), localeconv(3C-SVR4), mbtowc(3C-SVR4),
printf(3S-SVR4), strcoll(3C-SVR4), strftime(3C-SVR4),
strtod(3C-SVR4), strxfrm(3C-SVR4), wctomb(3C-SVR4),
environ(5-SVR4).
Printed 11/19/92 Page 3