HP-UX Reference (11i v3 07/02) - 3 Library Functions N-Z (vol 7)
s
setlocale(3C) setlocale(3C)
It should be noted that the locale state is common to all threads within a process.
getlocale_r()
and setlocale_r()
are obsolescent interfaces supported for compatibility with
existing DCE applications. New multithreaded applications should use
getlocale() and setlo-
cale()
.
Any program that calls setlocale() before catopen()
with the oflag parameter set to
NL_CAT_LOCALE
may behave differently in this release than in previous releases because of the addition
of
LC_MESSAGES to XPG4. In the past,
catopen() was directed to the desired language by LANG.
Now,
catopen() with the oflag parameter set to
NL_CAT_LOCALE, is controlled by
LC_MESSAGES .
setlocale() can modify the LC_MESSAGES category. For example, if the environment variables are
set as follows:
LC_MESSAGES="fr_FR.iso88591"
and the following call to setlocale() is made:
setlocale(LC_ALL, "de_DE.iso88591");
followed by a call to catopen(), then
catopen() will open the message catalogs for
de_DE.iso88591 rather than fr_FR.iso88591
.
If you use
setlocale() and compile/link your application archive on PA-RISC systems, please note that
setlocale() has a dependency on libdld.sl that will require a change to the compile/link com-
mand.
Compile:
cc -Wl,-a,archive -Wl,-E -Wl,+n -l:libdld.sl -o
outfile source
Or compile with
CCOPTS and LDOPTS:
export CCOPTS="-Wl,-a,archive
options -Wl,-E -l:libdld.sl"
export LDOPTS="
options -E +n -l:libdld.sl"
cc -o
outfile source
The option -Wl,-a,archive
is positionally dependent and should occur at the beginning of the compile
line. For optimum compatibility in future releases, avoid using archive
libc with other shared libraries
except for
libdld.sl as needed above.
AUTHOR
setlocale() , setlocale_r(),
getlocale() , and getlocale_r() were developed by OSF
and HP.
FILES
/usr/include/langinfo.h
/usr/include/locale.h
SEE ALSO
locale(1), localedef(1M), conv(3C), ctype(3C), ecvt(3C), getdate(3C), multibyte(3C), nl_langinfo(3C),
regcomp(3C), string(3C), perror(3C), strfmon(3C), strftime(3C), string(3C), strptime(3C), strtod(3C),
wcsftime(3C), wcstring(3C), printf(3S), scanf(3S), vprintf(3S), wconv(3C), wctype(3C), wcstod(3C),
wcstol(3C), environ(5), lang(5), langinfo(5), thread_safety(5).
STANDARDS CONFORMANCE
setlocale() : AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C
HP-UX 11i Version 3: February 2007 − 5 − Hewlett-Packard Company 401