2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright 1993 Mitchum DSouza <m.dsouza@mrc-applied-psychology.cambridge.ac.uk>
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\"
|
|
|
|
.\" Modified Thu Dec 13 22:51:19 2001 by Martin Schulze <joey@infodrom.org>
|
|
|
|
.\" Modified 2001-12-14 aeb
|
|
|
|
.\"
|
2006-05-17 21:49:21 +00:00
|
|
|
.TH CATOPEN 3 2001-12-14 "GNU" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
catopen, catclose \- open/close a message catalog
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B #include <nl_types.h>
|
|
|
|
.sp
|
|
|
|
.BI "nl_catd catopen(const char *" name ", int " flag );
|
2007-12-23 13:45:24 +00:00
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "int catclose(nl_catd " catalog );
|
|
|
|
.SH DESCRIPTION
|
|
|
|
The function
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR catopen ()
|
2004-11-03 13:51:07 +00:00
|
|
|
opens a message catalog and returns a catalog descriptor.
|
2007-04-12 22:42:49 +00:00
|
|
|
The descriptor remains valid until
|
|
|
|
.BR catclose ()
|
|
|
|
or
|
2007-05-12 00:30:29 +00:00
|
|
|
.BR execve (2).
|
2004-11-03 13:51:07 +00:00
|
|
|
If a file descriptor is used to implement catalog descriptors
|
2007-06-22 18:25:23 +00:00
|
|
|
then the
|
|
|
|
.B FD_CLOEXEC
|
|
|
|
flag will be set.
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
|
|
|
The argument
|
|
|
|
.I name
|
|
|
|
specifies the name of the message catalog to be opened.
|
|
|
|
If
|
|
|
|
.I name
|
2008-06-09 15:49:35 +00:00
|
|
|
specifies and absolute path (i.e., contains a \(aq/\(aq),
|
2004-11-03 13:51:07 +00:00
|
|
|
then
|
|
|
|
.I name
|
|
|
|
specifies a pathname for the message catalog.
|
|
|
|
Otherwise, the environment variable
|
|
|
|
.B NLSPATH
|
|
|
|
is used with
|
|
|
|
.I name
|
|
|
|
substituted for
|
|
|
|
.B %N
|
|
|
|
(see
|
|
|
|
.BR locale (7)).
|
|
|
|
It is unspecified whether
|
|
|
|
.B NLSPATH
|
|
|
|
will be used when the process has root privileges.
|
|
|
|
If
|
|
|
|
.B NLSPATH
|
|
|
|
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
|
|
|
|
locale setting when the
|
|
|
|
.I flag
|
|
|
|
argument is
|
|
|
|
.B NL_CAT_LOCALE
|
|
|
|
and on the
|
|
|
|
.B LANG
|
|
|
|
environment variable when the
|
|
|
|
.I flag
|
|
|
|
argument is 0.
|
2007-06-22 19:42:52 +00:00
|
|
|
Changing the
|
|
|
|
.B LC_MESSAGES
|
|
|
|
part of the locale may invalidate
|
2004-11-03 13:51:07 +00:00
|
|
|
open catalog descriptors.
|
|
|
|
.LP
|
|
|
|
The
|
|
|
|
.I flag
|
|
|
|
argument to
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR catopen ()
|
2004-11-03 13:51:07 +00:00
|
|
|
is used to indicate the source for the language to use.
|
|
|
|
If it is set to
|
|
|
|
.B NL_CAT_LOCALE
|
|
|
|
then it will use the current locale setting for
|
|
|
|
.BR LC_MESSAGES .
|
|
|
|
Otherwise it will use the
|
|
|
|
.B LANG
|
|
|
|
environment variable.
|
|
|
|
.LP
|
|
|
|
The function
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR catclose ()
|
2004-11-03 13:51:07 +00:00
|
|
|
closes the message catalog identified by
|
|
|
|
.IR catalog .
|
|
|
|
It invalidates any subsequent references to the message catalog
|
|
|
|
defined by
|
|
|
|
.IR catalog .
|
|
|
|
.SH "RETURN VALUE"
|
|
|
|
The function
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR catopen ()
|
2004-11-03 13:51:07 +00:00
|
|
|
returns a message catalog descriptor of type
|
|
|
|
.I nl_catd
|
|
|
|
on success.
|
2007-11-29 18:15:54 +00:00
|
|
|
On failure, it returns \fI(nl_catd)\ \-1\fP
|
2004-11-03 13:51:07 +00:00
|
|
|
and sets
|
2004-11-10 17:11:31 +00:00
|
|
|
.I errno
|
2007-04-12 22:42:49 +00:00
|
|
|
to indicate the error.
|
|
|
|
The possible error values include all
|
2004-11-03 13:51:07 +00:00
|
|
|
possible values for the
|
2007-05-12 00:30:29 +00:00
|
|
|
.BR open (2)
|
2004-11-03 13:51:07 +00:00
|
|
|
call.
|
|
|
|
.LP
|
|
|
|
The function
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR catclose ()
|
2004-11-03 13:51:07 +00:00
|
|
|
returns 0 on success, or \-1 on failure.
|
|
|
|
.SH ENVIRONMENT
|
|
|
|
.TP
|
|
|
|
.B LC_MESSAGES
|
2007-06-22 19:42:52 +00:00
|
|
|
May be the source of the
|
|
|
|
.B LC_MESSAGES
|
|
|
|
locale setting, and thus
|
2004-11-03 13:51:07 +00:00
|
|
|
determine the language to use if
|
|
|
|
.I flag
|
|
|
|
is set to
|
|
|
|
.BR NL_CAT_LOCALE .
|
|
|
|
.TP
|
|
|
|
.B LANG
|
|
|
|
The language to use if
|
|
|
|
.I flag
|
|
|
|
is 0.
|
2007-05-19 04:30:20 +00:00
|
|
|
.SH "CONFORMING TO"
|
|
|
|
POSIX.1-2001.
|
|
|
|
.\" In XPG 1987, Vol. 3 it says:
|
|
|
|
.\" .I "The flag argument of catopen is reserved for future use"
|
|
|
|
.\" .IR "and should be set to 0" .
|
2007-06-22 19:42:52 +00:00
|
|
|
It is unclear what the source was for the constants
|
|
|
|
.B MCLoadBySet
|
2007-06-23 07:19:07 +00:00
|
|
|
and
|
2007-06-22 19:42:52 +00:00
|
|
|
.B MCLoadAll
|
|
|
|
(see below).
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NOTES
|
2006-08-03 13:57:30 +00:00
|
|
|
The above is the POSIX.1-2001 description.
|
2007-06-22 19:42:52 +00:00
|
|
|
The glibc value for
|
|
|
|
.B NL_CAT_LOCALE
|
|
|
|
is 1.
|
|
|
|
(Compare
|
|
|
|
.B MCLoadAll
|
|
|
|
below.)
|
2004-11-03 13:51:07 +00:00
|
|
|
The default path varies, but usually looks at a number of places below
|
|
|
|
.IR /usr/share/locale .
|
intro.1, time.1, _syscall.2, accept.2, brk.2, capget.2, faccessat.2, futimesat.2, gethostname.2, intro.2, ioprio_set.2, kill.2, madvise.2, mlock.2, mount.2, msgget.2, perf_event_open.2, poll.2, readv.2, sched_rr_get_interval.2, sched_setscheduler.2, select.2, select_tut.2, shmget.2, stat.2, timer_create.2, ustat.2, vfork.2, wait.2, alloca.3, atexit.3, catopen.3, crypt.3, dbopen.3, fenv.3, fopen.3, getaddrinfo_a.3, gethostbyname.3, getutent.3, intro.3, login.3, mallopt.3, queue.3, regex.3, sigpause.3, sigsetops.3, stdio.3, strftime.3, strptime.3, sysconf.3, ttyslot.3, undocumented.3, cciss.4, console_codes.4, hpsa.4, initrd.4, intro.4, rtc.4, st.4, tty_ioctl.4, wavelan.4, acct.5, charmap.5, dir_colors.5, hosts.5, intro.5, termcap.5, utmp.5, intro.6, armscii-8.7, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, ddp.7, epoll.7, glob.7, intro.7, ip.7, ipv6.7, iso_8859-1.7, iso_8859-10.7, iso_8859-11.7, iso_8859-13.7, iso_8859-14.7, iso_8859-15.7, iso_8859-16.7, iso_8859-2.7, iso_8859-3.7, iso_8859-4.7, iso_8859-5.7, iso_8859-6.7, iso_8859-7.7, iso_8859-8.7, iso_8859-9.7, koi8-r.7, koi8-u.7, man-pages.7, man.7, math_error.7, netlink.7, numa.7, packet.7, path_resolution.7, pipe.7, pthreads.7, raw.7, rtnetlink.7, signal.7, socket.7, spufs.7, svipc.7, tcp.7, time.7, udp.7, udplite.7, unicode.7, unix.7, uri.7, utf-8.7, x25.7, intro.8: Global fix: use consistent capitalization in .SS headings
Capitalization in .SS sections across pages (and sometimes even
within a single page) is wildly inconsistent. Make it consistent.
Capitalize first word in heading, but otherwise use lower case,
except where English usage (e.g., proper nouns) or programming
language requirements (e.g., identifier names) dictate otherwise.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-02-24 14:08:38 +00:00
|
|
|
.SS Linux notes
|
2004-11-03 13:51:07 +00:00
|
|
|
These functions are available for Linux since libc 4.4.4c.
|
|
|
|
In the case of linux libc4 and libc5, the catalog descriptor
|
|
|
|
.I nl_catd
|
2007-04-12 22:42:49 +00:00
|
|
|
is a
|
2007-05-12 00:30:29 +00:00
|
|
|
.BR mmap (2)'ed
|
2005-10-20 15:11:10 +00:00
|
|
|
area of memory and not a file descriptor.
|
2004-11-03 13:51:07 +00:00
|
|
|
The
|
|
|
|
.I flag
|
|
|
|
argument to
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR catopen ()
|
2004-11-03 13:51:07 +00:00
|
|
|
should be either
|
|
|
|
.B MCLoadBySet
|
|
|
|
(=0) or
|
|
|
|
.B MCLoadAll
|
|
|
|
(=1).
|
|
|
|
The former value indicates that a set from the catalog is to be
|
|
|
|
loaded when needed, whereas the latter causes the initial call to
|
|
|
|
.BR catopen ()
|
|
|
|
to load the entire catalog into memory.
|
|
|
|
The default search path varies, but usually looks at a number of places below
|
|
|
|
.I /etc/locale
|
|
|
|
and
|
|
|
|
.IR /usr/lib/locale .
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR catgets (3),
|
|
|
|
.BR setlocale (3)
|