NL_INIT(3C) — HP-UX
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 langid(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), nl_string(3C), nl_tools_16(3C), printf(3S), printmsg(3C), scanf(3S), 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). Langinit is provided for historical reasons only. For maximum portability, use of nl_init is recommended.
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 as defined in langid(5) or if the environment tables for the specified language are unavailable for any reason.
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
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.
HARDWARE DEPENDENCIES
Series 200, 300, 500
The nl_init routine is not currently supported. Langinit, as supported on the Series 200, 300 and 500, has a subset of the functionality described above for that routine. Langinit initializes only that part of the NLS environment which is used by the routines and macros defined in strncmp16 and strcmp16 on nl_string(3C), nl_tools_16(3C), and nl_ctype(3C). The nl_ctype(3C) routines implicitly call langinit, while an explicit call is necessary prior to the use of any nl_tools_16(3C) routines and macros. Other routines that require a langid parameter do not make implicit calls to langinit and, therefore, have no effect on the nl_tools_16(3C) or nl_ctype(3C) portion of the NLS environment.
Contrary to the recommendations above, only the routines with a langid parameter provide NLS functionality and should, therefore, be used.
AUTHOR
Nl_init was developed by HP.
SEE ALSO
conv(3C), ctime(3C), ctype(3C), ecvt(3C), langinfo(3C), nl_conv(3C), nl_ctype(3C), nl_string(3C), nl_tools_16(3C), printf(3S), printmsg(3C), scanf(3S), string(3C), strtod(3C), vprintf(3S), environ(5), langid(5).
Hewlett-Packard Company — Version B.1, May 11, 2021