1CATOPEN(3) Linux Programmer's Manual CATOPEN(3)
2
3
4
6 catopen, catclose - open/close a message catalog
7
9 #include <nl_types.h>
10
11 nl_catd catopen(const char *name, int flag);
12 int catclose(nl_catd catalog);
13
15 The function catopen() opens a message catalog and returns a catalog
16 descriptor. The descriptor remains valid until catclose() or ex‐
17 ecve(2). If a file descriptor is used to implement catalog descrip‐
18 tors, then the FD_CLOEXEC flag will be set.
19
20 The argument name specifies the name of the message catalog to be
21 opened. If name specifies an absolute path (i.e., contains a '/'),
22 then name specifies a pathname for the message catalog. Otherwise, the
23 environment variable NLSPATH is used with name substituted for %N (see
24 locale(7)). It is unspecified whether NLSPATH will be used when the
25 process has root privileges. If NLSPATH does not exist in the environ‐
26 ment, or if a message catalog cannot be opened in any of the paths
27 specified by it, then an implementation defined path is used. This
28 latter default path may depend on the LC_MESSAGES locale setting when
29 the flag argument is NL_CAT_LOCALE and on the LANG environment variable
30 when the flag argument is 0. Changing the LC_MESSAGES part of the lo‐
31 cale may invalidate open catalog descriptors.
32
33 The flag argument to catopen() is used to indicate the source for the
34 language to use. If it is set to NL_CAT_LOCALE, then it will use the
35 current locale setting for LC_MESSAGES. Otherwise, it will use the
36 LANG environment variable.
37
38 The function catclose() closes the message catalog identified by cata‐
39 log. It invalidates any subsequent references to the message catalog
40 defined by catalog.
41
43 The function catopen() returns a message catalog descriptor of type
44 nl_catd on success. On failure, it returns (nl_catd) -1 and sets errno
45 to indicate the error. The possible error values include all possible
46 values for the open(2) call.
47
48 The function catclose() returns 0 on success, or -1 on failure.
49
51 LC_MESSAGES
52 May be the source of the LC_MESSAGES locale setting, and thus
53 determine the language to use if flag is set to NL_CAT_LOCALE.
54
55 LANG The language to use if flag is 0.
56
58 For an explanation of the terms used in this section, see at‐
59 tributes(7).
60
61 ┌────────────────────────────────────────┬───────────────┬─────────────┐
62 │Interface │ Attribute │ Value │
63 ├────────────────────────────────────────┼───────────────┼─────────────┤
64 │catopen() │ Thread safety │ MT-Safe env │
65 ├────────────────────────────────────────┼───────────────┼─────────────┤
66 │catclose() │ Thread safety │ MT-Safe │
67 └────────────────────────────────────────┴───────────────┴─────────────┘
68
70 POSIX.1-2001, POSIX.1-2008.
71
73 The above is the POSIX.1 description. The glibc value for NL_CAT_LO‐
74 CALE is 1. The default path varies, but usually looks at a number of
75 places below /usr/share/locale.
76
78 catgets(3), setlocale(3)
79
81 This page is part of release 5.12 of the Linux man-pages project. A
82 description of the project, information about reporting bugs, and the
83 latest version of this page, can be found at
84 https://www.kernel.org/doc/man-pages/.
85
86
87
88GNU 2021-03-22 CATOPEN(3)