Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ langinit(3C) — HP-UX 9.10

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

conv(3C)

ctime(3C)

ctype(3C)

ecvt(3C)

langinfo(3C)

multibyte(3C)

nl_conv(3C)

nl_ctype(3C)

nl_langinfo(3C)

nl_string(3C)

nl_tools_16(3C)

printf(3S)

printmsg(3C)

scanf(3S)

string(3C)

strtod(3C)

vprintf(3S)

environ(5)

hpnls(5)

lang(5)

nl_langinfo(5)

nl_init(3C)

NAME

nl_init(), langinit() − initialize the NLS environment of a program

SYNOPSIS

#include <langinfo.h>

int nl_init(const char *langname);

int langinit(const char *langname);

DESCRIPTION

nl_init() Initializes the NLS (Native Language Support) environment of a program to the language specified by langname. If langname is null or points to an empty string, the default-mode language, n-computer (see lang(5)), is initialized.

nl_init() affects the behavior of the macros and routines defined in conv(3C), ctime(3C), ctype(3C), ecvt(3C), langinfo(3C), multibyte(3C), nl_langinfo(3C), nl_string(3C), nl_tools_16(3C), printf(3S), printmsg(3C), scanf(3S), strftime(3C), string(3C), strtod(3C), and vprintf(3S).

Typically, nl_init() is used to bind program operation to the end-user’s specified language requirements.  For example,

nl_init(getenv("LANG"));

Prior to successfully calling nl_init(), functions supporting NLS operate as though the default-mode language n-computer had been initialized. 

langinit() Performs the same initialization of the environment control areas as does nl_init().  However, nl_init() and langinit() differ in the action taken when the requested language environment cannot be initialized (see ERRORS below). 

RETURN VALUE

nl_init() and langinit() return 0 if the environment is successfully initialized to the requested language.  Otherwise, they return −1. 

ERRORS

nl_init() fails if the string specified by langname does not identify a valid language name (see lang(3C)), or the language is not available on the system.

If nl_init() fails but had previously succeeded, operation continues with the environment initialized by the last successful call.  If nl_init() fails and has never been called successfully, the environment reverts to the default-mode language n-computer. 

If langinit() fails, the environment reverts to the default-mode language n-computer. 

WARNINGS

nl_init() and langinit() are provided for historical reasons only.  Use setlocale() instead (see setlocale(3C)). The default processing language for setlocale() is "C"; the default processing language for nl_init() is n-computer.  This is maintained for backward portability. 

langinit() is implicitly called by the macros and routines which use a langid parameter (see ctime(3C), langinfo(3C), nl_conv(3C), nl_ctype(3C), nl_string(3C), and strtod(3C)). Using any langid parameter routine or macro initializes the environment of the associated language name, thus affecting the behavior of other routines that interact with the NLS environment.  For maximum portability and performance, use of macros and routines without the langid parameter is recommended. 

AUTHOR

nl_init() was developed by HP. 

SEE ALSO

conv(3C), ctime(3C), ctype(3C), ecvt(3C), langinfo(3C), multibyte(3C), nl_conv(3C), nl_ctype(3C), nl_langinfo(3C), nl_string(3C), nl_tools_16(3C), printf(3S), printmsg(3C), scanf(3S), string(3C), strtod(3C), vprintf(3S), environ(5), hpnls(5), lang(5), nl_langinfo(5). 

STANDARDS CONFORMANCE

nl_init(): XPG2

Hewlett-Packard Company  —  HP-UX Release 9.10: April 1995

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