summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-rawhide/man3/catopen.3
blob: f3e0c33cbe0b4d0521c23d31e4cb86090d014890 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
'\" t
.\" Copyright 1993 Mitchum DSouza <m.dsouza@mrc-applied-psychology.cambridge.ac.uk>
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
.\" Modified Thu Dec 13 22:51:19 2001 by Martin Schulze <joey@infodrom.org>
.\" Modified 2001-12-14 aeb
.\"
.TH catopen 3 2023-10-31 "Linux man-pages 6.06"
.SH NAME
catopen, catclose \- open/close a message catalog
.SH LIBRARY
Standard C library
.RI ( libc ", " \-lc )
.SH SYNOPSIS
.nf
.B #include <nl_types.h>
.P
.BI "nl_catd catopen(const char *" name ", int " flag );
.BI "int catclose(nl_catd " catalog );
.fi
.SH DESCRIPTION
The function
.BR catopen ()
opens a message catalog and returns a catalog descriptor.
The descriptor remains valid until
.BR catclose ()
or
.BR execve (2).
If a file descriptor is used to implement catalog descriptors,
then the
.B FD_CLOEXEC
flag will be set.
.P
The argument
.I name
specifies the name of the message catalog to be opened.
If
.I name
specifies an absolute path (i.e., contains a \[aq]/\[aq]),
then
.I name
specifies a pathname for the message catalog.
Otherwise, the environment variable
.B NLSPATH
is used with
.I name
substituted for
.B %N
(see
.BR locale (7)).
It is unspecified whether
.B NLSPATH
will be used when the process has root privileges.
If
.B 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
.B LC_MESSAGES
locale setting when the
.I flag
argument is
.B NL_CAT_LOCALE
and on the
.B LANG
environment variable when the
.I flag
argument is 0.
Changing the
.B LC_MESSAGES
part of the locale may invalidate
open catalog descriptors.
.P
The
.I flag
argument to
.BR catopen ()
is used to indicate the source for the language to use.
If it is set to
.BR NL_CAT_LOCALE ,
then it will use the current locale setting for
.BR LC_MESSAGES .
Otherwise, it will use the
.B LANG
environment variable.
.P
The function
.BR catclose ()
closes the message catalog identified by
.IR catalog .
It invalidates any subsequent references to the message catalog
defined by
.IR catalog .
.SH RETURN VALUE
The function
.BR catopen ()
returns a message catalog descriptor of type
.I nl_catd
on success.
On failure, it returns
.I (nl_catd)\~\-1
and sets
.I errno
to indicate the error.
The possible error values include all
possible values for the
.BR open (2)
call.
.P
The function
.BR catclose ()
returns 0 on success, or \-1 on failure.
.SH ENVIRONMENT
.TP
.B LC_MESSAGES
May be the source of the
.B LC_MESSAGES
locale setting, and thus
determine the language to use if
.I flag
is set to
.BR NL_CAT_LOCALE .
.TP
.B LANG
The language to use if
.I flag
is 0.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.TS
allbox;
lbx lb lb
l l l.
Interface	Attribute	Value
T{
.na
.nh
.BR catopen ()
T}	Thread safety	MT-Safe env
T{
.na
.nh
.BR catclose ()
T}	Thread safety	MT-Safe
.TE
.SH VERSIONS
The above is the POSIX.1 description.
The glibc value for
.B NL_CAT_LOCALE
is 1.
.\" (Compare
.\" .B MCLoadAll
.\" below.)
The default path varies, but usually looks at a number of places below
.IR /usr/share/locale .
.\" .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 .
.SH STANDARDS
POSIX.1-2008.
.SH HISTORY
POSIX.1-2001.
.\" 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).
.SH SEE ALSO
.BR catgets (3),
.BR setlocale (3)