1CATOPEN(P)                 POSIX Programmer's Manual                CATOPEN(P)
2
3
4

NAME

6       catopen - open a message catalog
7

SYNOPSIS

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

DESCRIPTION

15       The  catopen()  function shall open a message catalog and return a mes‐
16       sage catalog descriptor. The name argument specifies the  name  of  the
17       message catalog to be opened. If name contains a '/' , then name speci‐
18       fies a complete name for the message catalog. Otherwise,  the  environ‐
19       ment  variable NLSPATH is used with name substituted for the %N conver‐
20       sion   specification   (see   the   Base    Definitions    volume    of
21       IEEE Std 1003.1-2001,  Chapter  8,  Environment  Variables). If NLSPATH
22       exists in the environment when the process starts, then if the  process
23       has  appropriate privileges, the behavior of catopen() is undefined. If
24       NLSPATH does not exist in the environment, or if a message catalog can‐
25       not  be  found  in  any of the components specified by NLSPATH, then an
26       implementation-defined default path shall be used. This default may  be
27       affected  by  the  setting  of  LC_MESSAGES  if  the  value of oflag is
28       NL_CAT_LOCALE, or the LANG environment variable if oflag is 0.
29
30       A message catalog descriptor shall remain valid in a process until that
31       process closes it, or a successful call to one of the exec functions. A
32       change in the setting of the LC_MESSAGES category may invalidate exist‐
33       ing open catalogs.
34
35       If  a file descriptor is used to implement message catalog descriptors,
36       the FD_CLOEXEC flag shall be set; see <fcntl.h>.
37
38       If the value of the oflag argument is 0, the LANG environment  variable
39       is  used  to locate the catalog without regard to the LC_MESSAGES cate‐
40       gory. If the oflag argument is NL_CAT_LOCALE, the LC_MESSAGES  category
41       is  used to locate the message catalog (see the Base Definitions volume
42       of IEEE Std 1003.1-2001, Section 8.2, Internationalization Variables).
43

RETURN VALUE

45       Upon successful completion, catopen() shall return  a  message  catalog
46       descriptor  for  use  on  subsequent calls to catgets() and catclose().
47       Otherwise, catopen() shall return ( nl_catd) -1 and set errno to  indi‐
48       cate the error.
49

ERRORS

51       The catopen() function may fail if:
52
53       EACCES Search permission is denied for the component of the path prefix
54              of the message catalog or read permission is denied for the mes‐
55              sage catalog.
56
57       EMFILE {OPEN_MAX}  file  descriptors  are currently open in the calling
58              process.
59
60       ENAMETOOLONG
61              The  length  of  a  pathname  of  the  message  catalog  exceeds
62              {PATH_MAX} or a pathname component is longer than {NAME_MAX}.
63
64       ENAMETOOLONG
65              Pathname  resolution of a symbolic link produced an intermediate
66              result whose length exceeds {PATH_MAX}.
67
68       ENFILE Too many files are currently open in the system.
69
70       ENOENT The message catalog does not exist or the name  argument  points
71              to an empty string.
72
73       ENOMEM Insufficient storage space is available.
74
75       ENOTDIR
76              A  component  of the path prefix of the message catalog is not a
77              directory.
78
79
80       The following sections are informative.
81

EXAMPLES

83       None.
84

APPLICATION USAGE

86       Some implementations of catopen() use malloc() to  allocate  space  for
87       internal  buffer  areas.  The  catopen()  function may fail if there is
88       insufficient storage space available to accommodate these buffers.
89
90       Conforming applications must assume that  message  catalog  descriptors
91       are not valid after a call to one of the exec functions.
92
93       Application writers should be aware that guidelines for the location of
94       message catalogs have not yet been  developed.  Therefore  they  should
95       take care to avoid conflicting with catalogs used by other applications
96       and the standard utilities.
97

RATIONALE

99       None.
100

FUTURE DIRECTIONS

102       None.
103

SEE ALSO

105       catclose()   ,   catgets()   ,   the   Base   Definitions   volume   of
106       IEEE Std 1003.1-2001,  <fcntl.h>, <nl_types.h>, the Shell and Utilities
107       volume of IEEE Std 1003.1-2001
108
110       Portions of this text are reprinted and reproduced in  electronic  form
111       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
112       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
113       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
114       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
115       event of any discrepancy between this version and the original IEEE and
116       The Open Group Standard, the original IEEE and The Open Group  Standard
117       is  the  referee document. The original Standard can be obtained online
118       at http://www.opengroup.org/unix/online.html .
119
120
121
122IEEE/The Open Group                  2003                           CATOPEN(P)
Impressum