1CATOPEN(3)                 Linux Programmer's Manual                CATOPEN(3)
2
3
4

NAME

6       catopen, catclose - open/close a message catalog
7

SYNOPSIS

9       #include <nl_types.h>
10
11       nl_catd catopen(const char *name, int flag);
12
13       int catclose(nl_catd catalog);
14

DESCRIPTION

16       The  function  catopen()  opens a message catalog and returns a catalog
17       descriptor.   The  descriptor  remains  valid   until   catclose()   or
18       execve(2).   If a file descriptor is used to implement catalog descrip‐
19       tors, then the FD_CLOEXEC flag will be set.
20
21       The argument name specifies the name  of  the  message  catalog  to  be
22       opened.   If  name  specifies  an absolute path (i.e., contains a '/'),
23       then name specifies a pathname for the message catalog.  Otherwise, the
24       environment  variable NLSPATH is used with name substituted for %N (see
25       locale(7)).  It is unspecified whether NLSPATH will be  used  when  the
26       process has root privileges.  If NLSPATH does not exist in the environ‐
27       ment, or if a message catalog cannot be opened  in  any  of  the  paths
28       specified  by  it,  then  an implementation defined path is used.  This
29       latter default path may depend on the LC_MESSAGES locale  setting  when
30       the flag argument is NL_CAT_LOCALE and on the LANG environment variable
31       when the flag argument is 0.  Changing  the  LC_MESSAGES  part  of  the
32       locale may invalidate open catalog descriptors.
33
34       The  flag  argument to catopen() is used to indicate the source for the
35       language to use.  If it is set to NL_CAT_LOCALE, then it will  use  the
36       current  locale  setting  for  LC_MESSAGES.  Otherwise, it will use the
37       LANG environment variable.
38
39       The function catclose() closes the message catalog identified by  cata‐
40       log.   It  invalidates any subsequent references to the message catalog
41       defined by catalog.
42

RETURN VALUE

44       The function catopen() returns a message  catalog  descriptor  of  type
45       nl_catd on success.  On failure, it returns (nl_catd) -1 and sets errno
46       to indicate the error.  The possible error values include all  possible
47       values for the open(2) call.
48
49       The function catclose() returns 0 on success, or -1 on failure.
50

ENVIRONMENT

52       LC_MESSAGES
53              May  be  the  source of the LC_MESSAGES locale setting, and thus
54              determine the language to use if flag is set to NL_CAT_LOCALE.
55
56       LANG   The language to use if flag is 0.
57

ATTRIBUTES

59       For  an  explanation  of  the  terms  used   in   this   section,   see
60       attributes(7).
61
62       ┌───────────┬───────────────┬─────────────┐
63Interface  Attribute     Value       
64       ├───────────┼───────────────┼─────────────┤
65catopen()  │ Thread safety │ MT-Safe env │
66       ├───────────┼───────────────┼─────────────┤
67catclose() │ Thread safety │ MT-Safe     │
68       └───────────┴───────────────┴─────────────┘

CONFORMING TO

70       POSIX.1-2001, POSIX.1-2008.
71

NOTES

73       The   above   is   the   POSIX.1  description.   The  glibc  value  for
74       NL_CAT_LOCALE is 1.  The default path varies, but usually  looks  at  a
75       number of places below /usr/share/locale.
76

SEE ALSO

78       catgets(3), setlocale(3)
79

COLOPHON

81       This  page  is  part of release 4.16 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                               2015-08-08                        CATOPEN(3)
Impressum