Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ langinit(3C) — HP-UX 7.01

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

int nl_init(langname)
char ∗langname;

int langinit(langname)
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

0 (zero) will be returned if the environment is successfully initialized to the requested language.  Otherwise, −1 will be returned. 

ERRORS

Nl_init will fail 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 will continue with the environment initialized by the last successful call.  If nl_init fails and has never been called successfully, the environment will revert to the default-mode language ­"n-computer". 

If langinit fails, the environment will revert to the default-mode language ­"n-computer". 

WARNINGS

Nl_init and langinit are provided for historical reasons only.  Use setlocale instead (see setlocale(3C)).  While 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 will initialize 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 7.0: Sept 1989

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