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 and 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 LANG
37       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

CONFORMING TO

59       POSIX.1-2001.  It is unclear what the  source  was  for  the  constants
60       MCLoadBySet and MCLoadAll (see below).
61

NOTES

63       The  above  is  the  POSIX.1-2001  description.   The  glibc  value for
64       NL_CAT_LOCALE is 1.   (Compare  MCLoadAll  below.)   The  default  path
65       varies,   but   usually   looks   at   a   number   of   places   below
66       /usr/share/locale.
67
68   Linux notes
69       These functions are available for Linux since libc 4.4.4c.  In the case
70       of  linux  libc4  and  libc5,  the  catalog  descriptor  nl_catd  is  a
71       mmap(2)'ed area of memory and not a file descriptor.  The flag argument
72       to  catopen() should be either MCLoadBySet (=0) or MCLoadAll (=1).  The
73       former value indicates that a set from the catalog is to be loaded when
74       needed, whereas the latter causes the initial call to catopen() to load
75       the entire catalog into memory.  The default search  path  varies,  but
76       usually   looks   at   a   number   of  places  below  /etc/locale  and
77       /usr/lib/locale.
78

SEE ALSO

80       catgets(3), setlocale(3)
81

COLOPHON

83       This page is part of release 3.53 of the Linux  man-pages  project.   A
84       description  of  the project, and information about reporting bugs, can
85       be found at http://www.kernel.org/doc/man-pages/.
86
87
88
89GNU                               2001-12-14                        CATOPEN(3)
Impressum