.\" 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 2001\-12\-14 GNU "Linux Programmer's Manual" .SH 名前 catopen, catclose \- メッセージカタログのオープン/クローズ .SH 書式 \fB#include \fP .sp \fBnl_catd catopen(const char *\fP\fIname\fP\fB, int \fP\fIflag\fP\fB);\fP \fBint catclose(nl_catd \fP\fIcatalog\fP\fB);\fP .SH 説明 関数 \fBcatopen\fP() はメッセージカタログをオープンし、カタログディスクリプタを返す。 このディスクリプタは \fBcatclose\fP() または \fBexecve\fP(2) が呼び出されるまで有効である。 カタログディスクリプタを実装するために ファイルディスクリプタを使用すると、 \fBFD_CLOEXEC\fP フラグが設定される。 .LP 引き数 \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 を変更すると、 オープンされているカタログディスクリプタが無効になるかもしれない。 .LP \fBcatopen\fP() の \fIflag\fP 引き数は、使用される言語のソースを示すために使われる。 \fBNL_CAT_LOCALE\fP に設定されると、 \fBLC_MESSAGES\fP の現在のロケール設定が使われる。 それ以外の場合は \fBLANG\fP 環境変数が使われる。 .LP 関数 \fBcatclose\fP() は \fIcatalog\fP で指定されたメッセージカタログをクローズする。 これは、以降の \fIcatalog\fP で指定されるメッセージカタログへの全ての参照を無効にする。 .SH 返り値 関数 \fBcatopen\fP() が成功すると、 \fInl_catd\fP 型のメッセージカタログディスクリプタを返す。 失敗した場合は \fI(nl_catdv) \-1\fP を返し、 \fIerrno\fP を設定してエラーを示す。 ここで起こり得るエラーの値には、 \fBopen\fP(2) の呼び出しの際に起こり得る全てのエラーの値が含まれる。 .LP 関数 \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 準拠 .\" 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" . POSIX.1\-2001. 定数 \fBMCLoadBySet\fP と \fBMCLoadAll\fP に対応するソースが何であるのかがはっきりしていない (下記参照)。 .SH 注意 以上は POSIX.1\-2001 における説明である。 glibc では \fBNL_CAT_LOCALE\fP の値は 1 である (以下の \fBMCLoadAll\fP と比較のこと)。 デフォルトのパスは場合によって様々であるが、通常は \fI/usr/share/locale\fP 以下のファイルが調べられる。 .SS "Linux における注意" これらの関数は libc.so.4.4.4c 以降で使用可能である。 linux の libc4 と libc5 においては、カタログディスクリプタ \fInl_catd\fP は \fBmmap\fP(2) されたメモリの領域であってファイルディスクリプタではない。 \fBcatopen\fP() の \fIflag\fP は、 \fBMCLoadBySet\fP (=0) か \fBMCLoadAll\fP (=1) のどちらかである。 前者の場合、カタログのセットは必要時にロードされる。 後者の場合、最初の \fBcatopen\fP() の呼び出しのときに全てのカタログがメモリ内にロードされる。 デフォルトのパスは場合によって様々であるが、通常は \fI/etc/locale\fP と \fI/usr/share/locale\fP 以下のファイルが調べられる。 .SH 関連項目 \fBcatgets\fP(3), \fBsetlocale\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。