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       int catclose(nl_catd catalog);
13

DESCRIPTION

15       The  function  catopen()  opens a message catalog and returns a catalog
16       descriptor.  The descriptor remains valid until catclose()  or  exec().
17       If  a file descriptor is used to implement catalog descriptors then the
18       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 and 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
31       locale 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 LANG
36       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

RETURN VALUE

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() call.
47
48       The function catclose() returns 0 on success, or -1 on failure.
49

ENVIRONMENT

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

NOTES

58       The above  is  the  POSIX.1-2001  description.   The  glibc  value  for
59       NL_CAT_LOCALE  is  1.   (Compare  MCLoadAll  below.)   The default path
60       varies,   but   usually   looks   at   a   number   of   places   below
61       /usr/share/locale.
62

NOTES FOR LIBC4 AND LIBC5

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

CONFORMING TO

75       POSIX.1-2001.   It  is  unclear  what  the source was for the constants
76       MCLoadBySet and MCLoadAll.
77

SEE ALSO

79       catgets(3), setlocale(3)
80
81
82
83GNU                               2001-12-14                        CATOPEN(3)
Impressum