.\" Copyright 1993 Mitchum DSouza .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" Modified Thu Dec 13 22:51:19 2001 by Martin Schulze .\" Modified 2001-12-14 aeb .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka .\" all rights reserved. .\" Translated Tue Dec 16 19:43:18 JST 1997 .\" by HIROFUMI Nishizuka .\" Updated & Modified Mon Jan 14 06:48:39 JST 2002 .\" by Yuichi SATO .\" .TH CATOPEN 3 2015\-08\-08 GNU "Linux Programmer's Manual" .SH 名前 catopen, catclose \- メッセージカタログのオープン/クローズ .SH 書式 \fB#include \fP .PP \fBnl_catd catopen(const char *\fP\fIname\fP\fB, int \fP\fIflag\fP\fB);\fP .PP \fBint catclose(nl_catd \fP\fIcatalog\fP\fB);\fP .SH 説明 関数 \fBcatopen\fP() はメッセージカタログをオープンし、カタログディスクリプターを返す。 このディスクリプターは \fBcatclose\fP() または \fBexecve\fP(2) が呼び出されるまで有効である。 カタログディスクリプターを実装するために ファイルディスクリプターを使用すると、 \fBFD_CLOEXEC\fP フラグが設定される。 .PP 引数 \fIname\fP はオープンするメッセージカタログの名前を指定する。 \fIname\fP が絶対パスで指定されている場合 (すなわち \(aq/\(aq を含んでいる場合)、 \fIname\fP はメッセージカタログへのパス名である。 それ以外の場合、環境変数 \fBNLSPATH\fP が \fIname\fP とともに使用され \fB%N\fP を置き換える (\fBlocale\fP(7) 参照)。 プロセスが root 権限を持っているときに \fBNLSPATH\fP が使われるかどうかは指定されていない。 \fBNLSPATH\fP 環境変数が存在しないか、 \fBNLSPATH\fP で指定されたパスの中の どのパスにおいてもメッセージカタログをオープンできない場合、 実装で定義されているパスが使われる。 後者のデフォルトパスは、 \fIflag\fP 引数が \fBNL_CAT_LOCALE\fP の場合には \fBLC_MESSAGES\fP のロケール設定に依存し、 \fIflag\fP 引数が 0 の場合には \fBLANG\fP 環境変数に依存する。 ロケールの \fBLC_MESSAGES\fP を変更すると、 オープンされているカタログディスクリプターが無効になるかもしれない。 .PP \fBcatopen\fP() の \fIflag\fP 引数は、使用される言語のソースを示すために使われる。 \fBNL_CAT_LOCALE\fP に設定されると、 \fBLC_MESSAGES\fP の現在のロケール設定が使われる。 それ以外の場合は \fBLANG\fP 環境変数が使われる。 .PP 関数 \fBcatclose\fP() は \fIcatalog\fP で指定されたメッセージカタログをクローズする。 これは、以降の \fIcatalog\fP で指定されるメッセージカタログへの全ての参照を無効にする。 .SH 返り値 関数 \fBcatopen\fP() が成功すると、 \fInl_catd\fP 型のメッセージカタログディスクリプターを返す。 失敗した場合は \fI(nl_catdv) \-1\fP を返し、 \fIerrno\fP を設定してエラーを示す。 ここで起こり得るエラーの値には、 \fBopen\fP(2) の呼び出しの際に起こり得る全てのエラーの値が含まれる。 .PP 関数 \fBcatclose\fP() は、成功した場合 0 を、失敗した場合 \-1 を返す。 .SH 環境変数 .TP \fBLC_MESSAGES\fP \fBLC_MESSAGES\fP ロケール設定のソースになることも可能なので、 \fIflag\fP が \fBNL_CAT_LOCALE\fP に設定されている場合は、使用する言語を決定するのに使われる。 .TP \fBLANG\fP \fIflag\fP が 0 の場合、使用する言語を決定する。 .SH 属性 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。 .TS allbox; lb lb lb l l l. インターフェース 属性 値 T{ \fBcatopen\fP() T} Thread safety MT\-Safe env T{ \fBcatclose\fP() T} Thread safety MT\-Safe .TE .SH 準拠 .\" In XPG 1987, Vol. 3 it says: .\" .I "The flag argument of catopen is reserved for future use" .\" .IR "and should be set to 0" . .\" .\" It is unclear what the source was for the constants .\" .B MCLoadBySet .\" and .\" .B MCLoadAll .\" (see below). POSIX.1\-2001, POSIX.1\-2008. .SH 注意 .\" (Compare .\" .B MCLoadAll .\" below.) .\" .SS Linux notes .\" These functions are available for Linux since libc 4.4.4c. .\" In the case of linux libc4 and libc5, the catalog descriptor .\" .I nl_catd .\" is a .\" .BR mmap (2)'ed .\" area of memory and not a file descriptor. .\" The .\" .I flag .\" argument to .\" .BR catopen () .\" should be either .\" .B MCLoadBySet .\" (=0) or .\" .B MCLoadAll .\" (=1). .\" The former value indicates that a set from the catalog is to be .\" loaded when needed, whereas the latter causes the initial call to .\" .BR catopen () .\" to load the entire catalog into memory. .\" The default search path varies, but usually looks at a number of places below .\" .I /etc/locale .\" and .\" .IR /usr/lib/locale . 以上は POSIX.1 における説明である。 glibc では \fBNL_CAT_LOCALE\fP の値は 1 である。 デフォルトのパスは場合によって様々であるが、通常は \fI/usr/share/locale\fP 以下のファイルが調べられる。 .SH 関連項目 \fBcatgets\fP(3), \fBsetlocale\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。