1CATOPEN(3P) POSIX Programmer's Manual CATOPEN(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 catopen - open a message catalog
13
15 #include <nl_types.h>
16
17 nl_catd catopen(const char *name, int oflag);
18
19
21 The catopen() function shall open a message catalog and return a mes‐
22 sage catalog descriptor. The name argument specifies the name of the
23 message catalog to be opened. If name contains a '/', then name speci‐
24 fies a complete name for the message catalog. Otherwise, the environ‐
25 ment variable NLSPATH is used with name substituted for the %N conver‐
26 sion specification (see the Base Definitions volume of
27 IEEE Std 1003.1-2001, Chapter 8, Environment Variables). If NLSPATH
28 exists in the environment when the process starts, then if the process
29 has appropriate privileges, the behavior of catopen() is undefined. If
30 NLSPATH does not exist in the environment, or if a message catalog can‐
31 not be found in any of the components specified by NLSPATH, then an
32 implementation-defined default path shall be used. This default may be
33 affected by the setting of LC_MESSAGES if the value of oflag is
34 NL_CAT_LOCALE, or the LANG environment variable if oflag is 0.
35
36 A message catalog descriptor shall remain valid in a process until that
37 process closes it, or a successful call to one of the exec functions. A
38 change in the setting of the LC_MESSAGES category may invalidate exist‐
39 ing open catalogs.
40
41 If a file descriptor is used to implement message catalog descriptors,
42 the FD_CLOEXEC flag shall be set; see <fcntl.h>.
43
44 If the value of the oflag argument is 0, the LANG environment variable
45 is used to locate the catalog without regard to the LC_MESSAGES cate‐
46 gory. If the oflag argument is NL_CAT_LOCALE, the LC_MESSAGES category
47 is used to locate the message catalog (see the Base Definitions volume
48 of IEEE Std 1003.1-2001, Section 8.2, Internationalization Variables).
49
51 Upon successful completion, catopen() shall return a message catalog
52 descriptor for use on subsequent calls to catgets() and catclose().
53 Otherwise, catopen() shall return ( nl_catd) -1 and set errno to indi‐
54 cate the error.
55
57 The catopen() function may fail if:
58
59 EACCES Search permission is denied for the component of the path prefix
60 of the message catalog or read permission is denied for the mes‐
61 sage catalog.
62
63 EMFILE {OPEN_MAX} file descriptors are currently open in the calling
64 process.
65
66 ENAMETOOLONG
67 The length of a pathname of the message catalog exceeds
68 {PATH_MAX} or a pathname component is longer than {NAME_MAX}.
69
70 ENAMETOOLONG
71 Pathname resolution of a symbolic link produced an intermediate
72 result whose length exceeds {PATH_MAX}.
73
74 ENFILE Too many files are currently open in the system.
75
76 ENOENT The message catalog does not exist or the name argument points
77 to an empty string.
78
79 ENOMEM Insufficient storage space is available.
80
81 ENOTDIR
82 A component of the path prefix of the message catalog is not a
83 directory.
84
85
86 The following sections are informative.
87
89 None.
90
92 Some implementations of catopen() use malloc() to allocate space for
93 internal buffer areas. The catopen() function may fail if there is
94 insufficient storage space available to accommodate these buffers.
95
96 Conforming applications must assume that message catalog descriptors
97 are not valid after a call to one of the exec functions.
98
99 Application writers should be aware that guidelines for the location of
100 message catalogs have not yet been developed. Therefore they should
101 take care to avoid conflicting with catalogs used by other applications
102 and the standard utilities.
103
105 None.
106
108 None.
109
111 catclose(), catgets(), the Base Definitions volume of
112 IEEE Std 1003.1-2001, <fcntl.h>, <nl_types.h>, the Shell and Utilities
113 volume of IEEE Std 1003.1-2001
114
116 Portions of this text are reprinted and reproduced in electronic form
117 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
118 -- Portable Operating System Interface (POSIX), The Open Group Base
119 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
120 Electrical and Electronics Engineers, Inc and The Open Group. In the
121 event of any discrepancy between this version and the original IEEE and
122 The Open Group Standard, the original IEEE and The Open Group Standard
123 is the referee document. The original Standard can be obtained online
124 at http://www.opengroup.org/unix/online.html .
125
126
127
128IEEE/The Open Group 2003 CATOPEN(3P)