OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[linuxjm/LDP_man-pages.git] / release / man3 / catopen.3
1 .\" Copyright 1993 Mitchum DSouza <m.dsouza@mrc-applied-psychology.cambridge.ac.uk>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Modified Thu Dec 13 22:51:19 2001 by Martin Schulze <joey@infodrom.org>
24 .\" Modified 2001-12-14 aeb
25 .\"
26 .\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka
27 .\"     all rights reserved.
28 .\" Translated Tue Dec 16 19:43:18 JST 1997
29 .\"     by HIROFUMI Nishizuka <nishi@rpts.cl.nec.co.jp>
30 .\" Updated & Modified Mon Jan 14 06:48:39 JST 2002
31 .\"     by Yuichi SATO <ysato@h4.dion.ne.jp>
32 .\"
33 .TH CATOPEN 3 2001-12-14 "GNU" "Linux Programmer's Manual"
34 .SH 名前
35 catopen, catclose \- メッセージカタログのオープン/クローズ
36 .SH 書式
37 .B #include <nl_types.h>
38 .sp
39 .BI "nl_catd catopen(const char *" name ", int " flag );
40
41 .BI "int catclose(nl_catd " catalog );
42 .SH 説明
43 関数
44 .BR catopen ()
45 はメッセージカタログをオープンし、カタログディスクリプタを返す。
46 このディスクリプタは
47 .BR catclose ()
48 または
49 .BR execve (2)
50 が呼び出されるまで有効である。
51 カタログディスクリプタを実装するために
52 ファイルディスクリプタを使用すると、
53 .B FD_CLOEXEC
54 フラグが設定される。
55 .LP
56 引き数
57 .I name
58 はオープンするメッセージカタログの名前を指定する。
59 .I name
60 が絶対パスで指定されている場合 (すなわち \(aq/\(aq を含んでいる場合)、
61 .I name
62 はメッセージカタログへのパス名である。
63 それ以外の場合、環境変数
64 .B NLSPATH
65
66 .I name
67 とともに使用され
68 .B %N
69 を置き換える
70 .RB ( locale (7)
71 参照)。
72 プロセスが root 権限を持っているときに
73 .B NLSPATH
74 が使われるかどうかは指定されていない。
75 .B NLSPATH
76 環境変数が存在しないか、
77 .B NLSPATH
78 で指定されたパスの中の
79 どのパスにおいてもメッセージカタログをオープンできない場合、
80 実装で定義されているパスが使われる。
81 後者のデフォルトパスは、
82 .I flag
83 引き数が
84 .B NL_CAT_LOCALE
85 の場合には
86 .B LC_MESSAGES
87 のロケール設定に依存し、
88 .I flag
89 引き数が 0 の場合には
90 .B LANG
91 環境変数に依存する。
92 ロケールの
93 .B LC_MESSAGES
94 を変更すると、
95 オープンされているカタログディスクリプタが無効になるかもしれない。
96 .LP
97 .BR catopen ()
98
99 .I flag
100 引き数は、使用される言語のソースを示すために使われる。
101 .B NL_CAT_LOCALE
102 に設定されると、
103 .B LC_MESSAGES
104 の現在のロケール設定が使われる。
105 それ以外の場合は
106 .B LANG
107 環境変数が使われる。
108 .LP
109 関数
110 .BR catclose ()
111
112 .I catalog
113 で指定されたメッセージカタログをクローズする。
114 これは、以降の
115 .I catalog
116 で指定されるメッセージカタログへの全ての参照を無効にする。
117 .SH 返り値
118 関数
119 .BR catopen ()
120 が成功すると、
121 .I nl_catd
122 型のメッセージカタログディスクリプタを返す。
123 失敗した場合は \fI(nl_catdv) \-1\fP を返し、
124 .I errno
125 を設定してエラーを示す。
126 ここで起こり得るエラーの値には、
127 .BR open (2)
128 の呼び出しの際に起こり得る全てのエラーの値が含まれる。
129 .LP
130 関数
131 .BR catclose ()
132 は、成功した場合 0 を、失敗した場合 \-1 を返す。
133 .SH 環境変数
134 .TP
135 .B LC_MESSAGES
136 .B LC_MESSAGES
137 ロケール設定のソースになることも可能なので、
138 .I flag
139
140 .B NL_CAT_LOCALE
141 に設定されている場合は、使用する言語を決定するのに使われる。
142 .TP
143 .B LANG
144 .I flag
145 が 0 の場合、使用する言語を決定する。
146 .SH 準拠
147 POSIX.1-2001.
148 .\" XPG 1987, Vol. 3 には、「\fIcatopen の flag 引き数は
149 .\" 将来使用するために予約されているので、
150 .\" 0 に設定しておくべきである。\fR」と書かれている。
151 定数
152 .B MCLoadBySet
153
154 .B MCLoadAll
155 に対応するソースが何であるのかがはっきりしていない (下記参照)。
156 .SH 注意
157 以上は POSIX.1-2001 における説明である。
158 glibc では
159 .B NL_CAT_LOCALE
160 の値は 1 である
161 (以下の
162 .B MCLoadAll
163 と比較のこと)。
164 デフォルトのパスは場合によって様々であるが、通常は
165 .I /usr/share/locale
166 以下のファイルが調べられる。
167 .SS Linux における注意
168 これらの関数は libc.so.4.4.4c 以降で使用可能である。
169 linux の libc4 と libc5 においては、カタログディスクリプタ
170 .I nl_catd
171
172 .BR mmap (2)
173 されたメモリの領域であってファイルディスクリプタではない。
174 .BR catopen ()
175
176 .I flag
177 は、
178 .B MCLoadBySet
179 (=0) か
180 .B MCLoadAll
181 (=1) のどちらかである。
182 前者の場合、カタログのセットは必要時にロードされる。
183 後者の場合、最初の
184 .BR catopen ()
185 の呼び出しのときに全てのカタログがメモリ内にロードされる。
186 デフォルトのパスは場合によって様々であるが、通常は
187 .I /etc/locale
188
189 .I /usr/share/locale
190 以下のファイルが調べられる。
191 .SH 関連項目
192 .BR catgets (3),
193 .BR setlocale (3)