CATOPEN(3)                 POSIX Programmer's Manual                CATOPEN(3)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.


NNAAMMEE
       catopen -- open a message catalog

SSYYNNOOPPSSIISS
       #include <nl_types.h>

       nl_catd catopen(const char *_n_a_m_e, int _o_f_l_a_g);

DDEESSCCRRIIPPTTIIOONN
       The _c_a_t_o_p_e_n() function shall open a message catalog and return a
       message catalog descriptor. The _n_a_m_e argument specifies the name of the
       message catalog to be opened. If _n_a_m_e contains a ''//'', then _n_a_m_e
       specifies a complete name for the message catalog. Otherwise, the
       environment variable _N_L_S_P_A_T_H is used with _n_a_m_e substituted for the %%NN
       conversion specification (see the Base Definitions volume of
       POSIX.1-2008, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t _V_a_r_i_a_b_l_e_s).  If _N_L_S_P_A_T_H exists in
       the environment when the process starts, then if the process has
       appropriate privileges, the behavior of _c_a_t_o_p_e_n() is undefined. If
       _N_L_S_P_A_T_H does not exist in the environment, or if a message catalog
       cannot be found in any of the components specified by _N_L_S_P_A_T_H, then an
       implementation-defined default path shall be used. This default may be
       affected by the setting of _L_C___M_E_S_S_A_G_E_S if the value of _o_f_l_a_g is
       NL_CAT_LOCALE, or the _L_A_N_G environment variable if _o_f_l_a_g is 0.

       A message catalog descriptor shall remain valid in a process until that
       process closes it, or a successful call to one of the _e_x_e_c functions. A
       change in the setting of the _L_C___M_E_S_S_A_G_E_S category may invalidate
       existing open catalogs.

       If a file descriptor is used to implement message catalog descriptors,
       the FD_CLOEXEC flag shall be set; see _<_f_c_n_t_l_._h_>.

       If the value of the _o_f_l_a_g argument is 0, the _L_A_N_G environment variable
       is used to locate the catalog without regard to the _L_C___M_E_S_S_A_G_E_S
       category. If the _o_f_l_a_g argument is NL_CAT_LOCALE, the _L_C___M_E_S_S_A_G_E_S
       category is used to locate the message catalog (see the Base
       Definitions volume of POSIX.1-2008, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
       _V_a_r_i_a_b_l_e_s).

RREETTUURRNN VVAALLUUEE
       Upon successful completion, _c_a_t_o_p_e_n() shall return a message catalog
       descriptor for use on subsequent calls to _c_a_t_g_e_t_s() and _c_a_t_c_l_o_s_e().
       Otherwise, _c_a_t_o_p_e_n() shall return (nnll__ccaattdd) -1 and set _e_r_r_n_o to
       indicate the error.

EERRRROORRSS
       The _c_a_t_o_p_e_n() function may fail if:

       EEAACCCCEESS Search permission is denied for the component of the path prefix
              of the message catalog or read permission is denied for the
              message catalog.

       EEMMFFIILLEE All file descriptors available to the process are currently
              open.

       EENNAAMMEETTOOOOLLOONNGG
              The length of a component of a pathname is longer than
              {NAME_MAX}.

       EENNAAMMEETTOOOOLLOONNGG
              The length of a pathname exceeds {PATH_MAX}, or pathname
              resolution of a symbolic link produced an intermediate result
              with a length that exceeds {PATH_MAX}.

       EENNFFIILLEE Too many files are currently open in the system.

       EENNOOEENNTT The message catalog does not exist or the _n_a_m_e argument points
              to an empty string.

       EENNOOMMEEMM Insufficient storage space is available.

       EENNOOTTDDIIRR
              A component of the path prefix of the message catalog names an
              existing file that is neither a directory nor a symbolic link to
              a directory, or the pathname of the message catalog contains at
              least one non-<slash> character and ends with one or more
              trailing <slash> characters and the last pathname component
              names an existing file that is neither a directory nor a
              symbolic link to a directory.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

EEXXAAMMPPLLEESS
       None.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       Some implementations of _c_a_t_o_p_e_n() use _m_a_l_l_o_c() to allocate space for
       internal buffer areas. The _c_a_t_o_p_e_n() function may fail if there is
       insufficient storage space available to accommodate these buffers.

       Conforming applications must assume that message catalog descriptors
       are not valid after a call to one of the _e_x_e_c functions.

       Application developers should be aware that guidelines for the location
       of message catalogs have not yet been developed. Therefore they should
       take care to avoid conflicting with catalogs used by other applications
       and the standard utilities.

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _c_a_t_c_l_o_s_e(), _c_a_t_g_e_t_s()

       The Base Definitions volume of POSIX.1-2008, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
       _V_a_r_i_a_b_l_e_s, <<ffccnnttll..hh>>, <<nnll__ttyyppeess..hh>>,

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
       -- Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, Copyright (C) 2013 by the Institute of
       Electrical and Electronics Engineers, Inc and The Open Group.  (This is
       POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
       event of any discrepancy between this version and the original IEEE and
       The Open Group Standard, the original IEEE and The Open Group Standard
       is the referee document. The original Standard can be obtained online
       at http://www.unix.org/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2013                           CATOPEN(3)
