2 .\" Copyright 1989 AT&T Copyright (c) 1995, Sun Microsystems, Inc. All Rights Reserved Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 .\" http://www.opengroup.org/bookstore/.
5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 .\" This notice shall appear on any product containing this material.
7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 .TH CATOPEN 3C "Dec 29, 1996"
12 catopen, catclose \- open/close a message catalog
18 \fBnl_catd\fR \fBcatopen\fR(\fBconst char *\fR\fIname\fR, \fBint\fR \fIoflag\fR);
23 \fBint\fR \fBcatclose\fR(\fBnl_catd\fR \fIcatd\fR);
29 The \fBcatopen()\fR function opens a message catalog and returns a message
30 catalog descriptor. \fIname\fR specifies the name of the message catalog to be
31 opened. If \fIname\fR contains a "/", then \fIname\fR specifies a complete
32 pathname for the message catalog; otherwise, the environment variable
33 \fBNLSPATH\fR is used and \fB/usr/lib/locale/\fR\fIlocale\fR\fB/LC_MESSAGES\fR
34 must exist. If \fBNLSPATH\fR does not exist in the environment, or if a message
35 catalog cannot be opened in any of the paths specified by \fBNLSPATH\fR, then
36 the default path \fB/usr/lib/locale/\fIlocale\fR/LC_MESSAGES\fR is used. In the
37 "C" locale, \fBcatopen()\fR will always succeed without checking the default
41 The names of message catalogs and their location in the filesystem can vary
42 from one system to another. Individual applications can choose to name or
43 locate message catalogs according to their own special needs. A mechanism is
44 therefore required to specify where the catalog resides.
47 The \fBNLSPATH\fR variable provides both the location of message catalogs, in
48 the form of a search path, and the naming conventions associated with message
49 catalog files. For example:
53 NLSPATH=/nlslib/%L/%N.cat:/nlslib/%N/%L
59 The metacharacter \fB%\fR introduces a substitution field, where \fB%L\fR
60 substitutes the current setting of either the \fBLANG\fR environment variable,
61 if the value of \fIoflag\fR is \fB0\fR, or the \fBLC_MESSAGES\fR category, if
62 the value of \fIoflag\fR is \fBNL_CAT_LOCALE\fR, and \fB%N\fR substitutes the
63 value of the \fIname\fR parameter passed to \fBcatopen()\fR. Thus, in the above
64 example, \fBcatopen()\fR will search in \fB/nlslib/$LANG/\fIname\fR.cat\fR, if
65 \fIoflag\fR is \fB0\fR, or in \fB/nlslib/{LC_MESSAGES}/\fIname\fR.cat\fR, if
66 \fIoflag\fR is \fBNL_CAT_LOCALE\fR.
69 The \fBNLSPATH\fR variable will normally be set up on a system wide basis (in
70 \fB/etc/profile\fR) and thus makes the location and naming conventions
71 associated with message catalogs transparent to both programs and users.
74 The full set of metacharacters is:
81 The value of the name parameter passed to \fBcatopen()\fR.
90 The value of \fBLANG\fR or \fBLC_MESSAGES\fR.
99 The value of the \fIlanguage\fR element of \fBLANG\fR or \fBLC_MESSAGES\fR.
108 The value of the \fIterritory\fR element of \fBLANG\fR or \fBLC_MESSAGES\fR.
117 The value of the \fIcodeset\fR element of \fBLANG\fR or \fBLC_MESSAGES\fR.
131 The \fBLANG\fR environment variable provides the ability to specify the user's
132 requirements for native languages, local customs and character set, as an ASCII
137 LANG=language[_territory[.codeset]]
143 A user who speaks German as it is spoken in Austria and has a terminal which
144 operates in ISO 8859/1 codeset, would want the setting of the LANG variable to
155 With this setting it should be possible for that user to find any relevant
156 catalogs should they exist.
159 Should the \fBLANG\fR variable not be set, the value of \fBLC_MESSAGES\fR as
160 returned by \fBsetlocale()\fR is used. If this is \fINULL,\fR the default path
161 as defined in <\fBnl_types.h\fR> is used.
164 A message catalogue descriptor remains valid in a process until that process
165 closes it, or a successful call to one of the \fBexec\fR functions. A change in
166 the setting of the \fBLC_MESSAGES\fR category may invalidate existing open
170 If a file descriptor is used to implement message catalogue descriptors, the
171 \fBFD_CLOEXEC\fR flag will be set; see <\fBfcntl.h\fR>.
174 If the value of \fIoflag\fR argument is \fB0\fR, the \fBLANG\fR environment
175 variable is used to locate the catalogue without regard to the
176 \fBLC_MESSAGES\fR category. If the \fIoflag\fR argument is
177 \fBNL_CAT_LOCALE\fR, the \fBLC_MESSAGES\fR category is used to locate the
181 The \fBcatclose()\fR function closes the message catalog identified by
182 \fIcatd\fR. If a file descriptor is used to implement the type \fBnl_catd\fR,
183 that file descriptor will be closed.
187 Upon successful completion, \fBcatopen()\fR returns a message catalog
188 descriptor for use on subsequent calls to \fBcatgets()\fR and
189 \fBcatclose()\fR. Otherwise it returns \fB(nl_catd) \(mi1\fR.
192 Upon successful completion, \fBcatclose()\fR returns 0. Otherwise it returns
193 \(mi1 and sets \fBerrno\fR to indicate the error.
197 The \fBcatopen()\fR function may fail if:
204 Search permission is denied for the component of the path prefix of the message
205 catalogue or read permission is denied for the message catalogue.
214 There are \fBOPEN_MAX\fR file descriptors currently open in the calling
221 \fB\fBENAMETOOLONG\fR\fR
224 The length of the pathname of the message catalogue exceeds \fIPATH_MAX\fR, or
225 a pathname component is longer than \fINAME_MAX\fR.
231 \fB\fBENAMETOOLONG\fR\fR
234 Pathname resolution of a symbolic link produced an intermediate result whose
235 length exceeds \fIPATH_MAX\fR.
244 Too many files are currently open in the system.
253 The message catalogue does not exist or the \fIname\fR argument points to an
263 Insufficient storage space is available.
272 A component of the path prefix of the message catalogue is not a directory.
277 The \fBcatclose()\fR function may fail if:
284 The catalogue descriptor is not valid.
293 The \fBcatclose()\fR function was interrupted by a signal.
299 The \fBcatopen()\fR and \fBcatclose()\fR functions can be used safely in
300 multithreaded applications, as long as \fBsetlocale\fR(3C) is not being called
301 to change the locale.
305 See \fBattributes\fR(5) for descriptions of the following attributes:
313 ATTRIBUTE TYPE ATTRIBUTE VALUE
315 Interface Stability Standard
323 \fBgencat\fR(1), \fBcatgets\fR(3C), \fBgettext\fR(3C), \fBnl_types.h\fR(3HEAD),
324 \fBsetlocale\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5)