man-pages/man3/catopen.3.html
2021-03-31 01:06:50 +01:00

297 lines
5.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of CATOPEN</TITLE>
</HEAD><BODY>
<H1>CATOPEN</H1>
Section: Linux Programmer's Manual (3)<BR>Updated: 2015-08-08<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
catopen, catclose - open/close a message catalog
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>#include &lt;<A HREF="file:///usr/include/nl_types.h">nl_types.h</A>&gt;</B>
<P>
<B>nl_catd catopen(const char *</B><I>name</I><B>, int </B><I>flag</I><B>);</B>
<P>
<B>int catclose(nl_catd </B><I>catalog</I><B>);</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The function
<B>catopen</B>()
opens a message catalog and returns a catalog descriptor.
The descriptor remains valid until
<B>catclose</B>()
or
<B><A HREF="/cgi-bin/man/man2html?2+execve">execve</A></B>(2).
If a file descriptor is used to implement catalog descriptors,
then the
<B>FD_CLOEXEC</B>
flag will be set.
<P>
The argument
<I>name</I>
specifies the name of the message catalog to be opened.
If
<I>name</I>
specifies an absolute path (i.e., contains a '/'),
then
<I>name</I>
specifies a pathname for the message catalog.
Otherwise, the environment variable
<B>NLSPATH</B>
is used with
<I>name</I>
substituted for
<B>%N</B>
(see
<B><A HREF="/cgi-bin/man/man2html?7+locale">locale</A></B>(7)).
It is unspecified whether
<B>NLSPATH</B>
will be used when the process has root privileges.
If
<B>NLSPATH</B>
does not exist in the environment,
or if a message catalog cannot be opened
in any of the paths specified by it,
then an implementation defined path is used.
This latter default path may depend on the
<B>LC_MESSAGES</B>
locale setting when the
<I>flag</I>
argument is
<B>NL_CAT_LOCALE</B>
and on the
<B>LANG</B>
environment variable when the
<I>flag</I>
argument is 0.
Changing the
<B>LC_MESSAGES</B>
part of the locale may invalidate
open catalog descriptors.
<P>
The
<I>flag</I>
argument to
<B>catopen</B>()
is used to indicate the source for the language to use.
If it is set to
<B>NL_CAT_LOCALE</B>,
then it will use the current locale setting for
<B>LC_MESSAGES</B>.
Otherwise, it will use the
<B>LANG</B>
environment variable.
<P>
The function
<B>catclose</B>()
closes the message catalog identified by
<I>catalog</I>.
It invalidates any subsequent references to the message catalog
defined by
<I>catalog</I>.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
The function
<B>catopen</B>()
returns a message catalog descriptor of type
<I>nl_catd</I>
on success.
On failure, it returns
<I>(nl_catd)&nbsp;-1</I>
and sets
<I>errno</I>
to indicate the error.
The possible error values include all
possible values for the
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2)
call.
<P>
The function
<B>catclose</B>()
returns 0 on success, or -1 on failure.
<A NAME="lbAF">&nbsp;</A>
<H2>ENVIRONMENT</H2>
<DL COMPACT>
<DT id="1"><B>LC_MESSAGES</B>
<DD>
May be the source of the
<B>LC_MESSAGES</B>
locale setting, and thus
determine the language to use if
<I>flag</I>
is set to
<B>NL_CAT_LOCALE</B>.
<DT id="2"><B>LANG</B>
<DD>
The language to use if
<I>flag</I>
is 0.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>ATTRIBUTES</H2>
For an explanation of the terms used in this section, see
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
<TABLE BORDER>
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
<TR VALIGN=top><TD>
<B>catopen</B>()
</TD><TD>Thread safety</TD><TD>MT-Safe env<BR></TD></TR>
<TR VALIGN=top><TD>
<B>catclose</B>()
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
</TABLE>
<A NAME="lbAH">&nbsp;</A>
<H2>CONFORMING TO</H2>
POSIX.1-2001, POSIX.1-2008.
<A NAME="lbAI">&nbsp;</A>
<H2>NOTES</H2>
The above is the POSIX.1 description.
The glibc value for
<B>NL_CAT_LOCALE</B>
is 1.
The default path varies, but usually looks at a number of places below
<I>/usr/share/locale</I>.
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+catgets">catgets</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+setlocale">setlocale</A></B>(3)
<A NAME="lbAK">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="3"><A HREF="#lbAB">NAME</A><DD>
<DT id="4"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="5"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="6"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="7"><A HREF="#lbAF">ENVIRONMENT</A><DD>
<DT id="8"><A HREF="#lbAG">ATTRIBUTES</A><DD>
<DT id="9"><A HREF="#lbAH">CONFORMING TO</A><DD>
<DT id="10"><A HREF="#lbAI">NOTES</A><DD>
<DT id="11"><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT id="12"><A HREF="#lbAK">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:37 GMT, March 31, 2021
</BODY>
</HTML>