catopen

Section: C Library Functions (3)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

catopen, catclose - メッセージカタログのオープン/クローズ  

ライブラリ

標準 C ライブラリ (libc,~-lc)  

書式

#include <nl_types.h>

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

説明

関数 catopen() はメッセージカタログをオープンし、カタログディスクリプターを返す。 このディスクリプターは catclose() または execve(2) が呼び出されるまで有効である。 カタログディスクリプターを実装するために ファイルディスクリプターを使用すると、 FD_CLOEXEC フラグが設定される。

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 で指定されるメッセージカタログへの全ての参照を無効にする。  

返り値

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

関数 catclose() は、成功した場合 0 を、失敗した場合 -1 を返す。  

環境変数

LC_MESSAGES
LC_MESSAGES ロケール設定のソースになることも可能なので、 flag が NL_CAT_LOCALE に設定されている場合は、使用する言語を決定するのに使われる。
LANG
flag が 0 の場合、使用する言語を決定する。
 

属性

この節で使用されている用語の説明については、 attributes(7) を参照。
インターフェース属性値
catopen() Thread safetyMT-Safe env
catclose() Thread safetyMT-Safe
 

バージョン

以上は POSIX.1 における説明である。 glibc では NL_CAT_LOCALE の値は 1 である。 デフォルトのパスは場合によって様々であるが、通常は /usr/share/locale 以下のファイルが調べられる。  

標準規格

POSIX.1-2008.  

歴史

POSIX.1-2001.  

関連項目

catgets(3), setlocale(3)


 

Index

名前
ライブラリ
書式
説明
返り値
環境変数
属性
バージョン
標準規格
歴史
関連項目

This document was created by man2html, using the manual pages.