Manpage of CATOPEN

CATOPEN

Section: Linux Programmer's Manual (3)
Updated: 2015-08-08
Index
 

NAME

catopen, catclose - open/close a message catalog  

SYNOPSIS

#include <nl_types.h>

nl_catd catopen(const char *name, int flag);

int catclose(nl_catd catalog); 

DESCRIPTION

The function catopen() opens a message catalog and returns a catalog descriptor. The descriptor remains valid until catclose() or execve(2). If a file descriptor is used to implement catalog descriptors, then the FD_CLOEXECflag will be set.

The argument namespecifies the name of the message catalog to be opened. If namespecifies an absolute path (i.e., contains a aq/aq), then namespecifies a pathname for the message catalog. Otherwise, the environment variable NLSPATHis used with namesubstituted for %N(see locale(7)). It is unspecified whether NLSPATHwill be used when the process has root privileges. If NLSPATHdoes not exist in the environment, or if a message catalog cannot be opened in any of the paths specified by it, then an implementation defined path is used. This latter default path may depend on the LC_MESSAGESlocale setting when the flagargument is NL_CAT_LOCALEand on the LANGenvironment variable when the flagargument is 0. Changing the LC_MESSAGESpart of the locale may invalidate open catalog descriptors.

The flagargument to catopen() is used to indicate the source for the language to use. If it is set to NL_CAT_LOCALE, then it will use the current locale setting for LC_MESSAGES. Otherwise, it will use the LANGenvironment variable.

The function catclose() closes the message catalog identified by catalog. It invalidates any subsequent references to the message catalog defined by catalog.  

RETURN VALUE

The function catopen() returns a message catalog descriptor of type nl_catdon success. On failure, it returns (nl_catd) -1and sets errnoto indicate the error. The possible error values include all possible values for the open(2) call.

The function catclose() returns 0 on success, or -1 on failure.  

ENVIRONMENT

LC_MESSAGES
May be the source of the LC_MESSAGESlocale setting, and thus determine the language to use if flagis set to NL_CAT_LOCALE.
LANG
The language to use if flagis 0.
 

ATTRIBUTES

For an explanation of the terms used in this section, see attributes(7).
InterfaceAttributeValue
catopen() Thread safetyMT-Safe env
catclose() Thread safetyMT-Safe
 

CONFORMING TO

POSIX.1-2001, POSIX.1-2008.  

NOTES

The above is the POSIX.1 description. The glibc value for NL_CAT_LOCALEis 1. The default path varies, but usually looks at a number of places below /usr/share/locale.  

SEE ALSO

catgets(3), setlocale(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ENVIRONMENT
ATTRIBUTES
CONFORMING TO
NOTES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 22:28:00 GMT, June 20, 2016