#include <nl_types.h> nl_catd catopen(const char *name, int flag); int catclose(nl_catd catalog);
The argument name specifies the name of the message catalog to be opened. If name specifies an absolute path (i.e., contains a '/'), then name specifies a pathname for the message catalog. Otherwise, the environment variable NLSPATH is used with name substituted for %N (see locale(7)). It is unspecified whether NLSPATH will be used when the process has root privileges. If NLSPATH does 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_MESSAGES locale setting when the flag argument is NL_CAT_LOCALE and on the LANG environment variable when the flag argument is 0. Changing the LC_MESSAGES part of the locale may invalidate open catalog descriptors.
catopen() の flag 引数は、使用される言語のソースを示すために使われる。 NL_CAT_LOCALE に設定されると、 LC_MESSAGES の現在のロケール設定が使われる。 それ以外の場合は LANG 環境変数が使われる。
関数 catclose() は catalog で指定されたメッセージカタログをクローズする。 これは、以降の catalog で指定されるメッセージカタログへの全ての参照を無効にする。
関数 catclose() は、成功した場合 0 を、失敗した場合 -1 を返す。
| インターフェース | 属性 | 値 |
| catopen() | Thread safety | MT-Safe env |
| catclose() | Thread safety | MT-Safe |