165 lines
4.7 KiB
Plaintext
165 lines
4.7 KiB
Plaintext
'\"macro stdmacro
|
|
.if n .pH g3c.catopen @(#)catopen 41.3 of 5/26/91
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989, 1990 AT&T
|
|
'\"macro stdmacro
|
|
.if n .pH g3.catopen @(#)nls 1.1
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.nr X
|
|
.if \nX=0 .ds x} catopen 3C "" "\&"
|
|
.if \nX=1 .ds x} catopen 3C ""
|
|
.if \nX=2 .ds x} catopen 3C "" "\&"
|
|
.if \nX=3 .ds x} catopen "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
\f4catopen\f1, \f4catclose\f1 \- open/close a message catalogue
|
|
.SH SYNOPSIS
|
|
\f4#include <nl_types.h>
|
|
.PP
|
|
\f4nl_catd catopen (const char \(**name, int oflag);
|
|
.PP
|
|
\f4int catclose (nl_catd catd);\f1
|
|
.SH "DESCRIPTION"
|
|
\f4catopen\fP
|
|
opens a message catalogue and returns a catalogue descriptor.
|
|
\f2name\fP
|
|
specifies the name of the message catalogue to be opened.
|
|
If
|
|
\f2name\fP
|
|
contains a ``/'' then
|
|
\f2name\fP
|
|
specifies a pathname for the message catalogue.
|
|
Otherwise, the environment variable
|
|
\f4NLSPATH\fP
|
|
is used.
|
|
If
|
|
\f4NLSPATH\fP
|
|
does not exist in the environment,
|
|
or if a message catalogue cannot be opened
|
|
in any of the paths specified by
|
|
\f4NLSPATH\fP,
|
|
then the default path is used [see \f4nl_types\fP(5)].
|
|
.P
|
|
The names of message catalogues, and their location in
|
|
the filestore, can vary from one system to another.
|
|
Individual applications can choose to name or locate
|
|
message catalogues according to their own special
|
|
needs.
|
|
A mechanism is therefore required to specify
|
|
where the catalogue resides.
|
|
.P
|
|
The \f4NLSPATH\fP variable
|
|
provides both the location of message catalogues,
|
|
in the form of a search path,
|
|
and the naming conventions associated with message
|
|
catalogue files. For example:
|
|
.PP
|
|
.RS
|
|
\f4NLSPATH=/nlslib/%L/%N.cat:/nlslib/%N/%L\fP
|
|
.RE
|
|
.PP
|
|
The metacharacter \f4%\fP
|
|
introduces a substitution field, where \f4%L\fP
|
|
substitutes
|
|
the current setting of the \f4LANG\fP environment variable
|
|
if \f2oflag\fP is 0
|
|
or
|
|
the current setting of the \f4LC_MESSAGES\fP category
|
|
if \f2oflag\fP is \f4NL_CAT_LOCALE\fP (see following section),
|
|
and
|
|
\f4%N\fP
|
|
substitutes the value of the
|
|
\f2name\fP
|
|
parameter passed to
|
|
\f4catopen\fP.
|
|
Thus, in the above example, if \f2oflag\fP is 0,
|
|
\f4catopen\fP
|
|
will search in
|
|
\f4/nlslib/$LANG/\f2name\fP.cat\f1,
|
|
then in
|
|
\f4/nlslib/\f2name\f4/$LANG\f1,
|
|
for the required message catalogue.
|
|
.P
|
|
\f4NLSPATH\fP
|
|
will normally be set up on a system wide basis (e.g., in
|
|
\f4/etc/profile\fP)
|
|
and thus makes the location and naming
|
|
conventions associated with message catalogues transparent
|
|
to both programs and users.
|
|
.P
|
|
The full set of metacharacters is:
|
|
.RS
|
|
.TP 5
|
|
\f4%N\fP
|
|
The value of the name parameter passed to \f4catopen\fP.
|
|
.TP 5
|
|
\f4%L\fP
|
|
The value of \f4LANG\fP environment variable if \f2oflag\fP is 0.
|
|
The value of \f4LC_MESSAGES\fP category if \f2oflag\fP is \f4NL_CAT_LOCALE\fP.
|
|
.TP 5
|
|
\f4%l\fP
|
|
The value of the language element of \f4LANG\fP environment variable if \f2oflag\fP is 0.
|
|
The value of the language element of \f4LC_MESSAGES\fP category if \f2oflag\fP is \f4NL_CAT_LOCALE\fP.
|
|
.TP 5
|
|
\f4%t\fP
|
|
The value of the territory element of \f4LANG\fP environment variable if \f2oflag\fP is 0.
|
|
The value of the territory element of \f4LC_MESSAGES\fP category if \f2oflag\fP is \f4NL_CAT_LOCALE\fP.
|
|
.TP 5
|
|
\f4%c\fP
|
|
The value of the codeset element of \f4LANG\fP environment variable if \f2oflag\fP is 0.
|
|
The value of the codeset element of \f4LC_MESSAGES\fP category if \f2oflag\fP is \f4NL_CAT_LOCALE\fP.
|
|
.TP 5
|
|
\f4%%\fP
|
|
A single %.
|
|
.RE
|
|
.P
|
|
The \f4LANG\fP environment variable provides the ability to specify the user's
|
|
requirements for native languages, local customs, and character set, as an
|
|
\s-1ASCII\s+1 string in the form
|
|
.sp .5
|
|
.RS
|
|
\f4LANG=language[_territory[.codeset]]\fP
|
|
.RE
|
|
.PP
|
|
A user who speaks German as it is spoken in Austria and has a terminal
|
|
which operates in \s-1ISO\s+1 8859/1 codeset, would want the setting of
|
|
the \f4LANG\fP variable to be
|
|
.PP
|
|
.RS
|
|
\f4LANG=De_A.88591\fP
|
|
.RE
|
|
.PP
|
|
With this setting it should be possible for that user to find any
|
|
relevant catalogues should they exist.
|
|
.PP
|
|
If it still can't find the catalogue file, then the default
|
|
path as defined in \f4nl_types\fP is used.
|
|
.P
|
|
\f2oflag\fP
|
|
is used to locate the catalogue file. If \f2oflag\fP is 0, the \f4LANG\fP environment
|
|
variable is used to locate it. If \f2oflag\fP is set to \f4NL_CAT_LOCALE\fP, the \f4LC_MESSAGES\fP
|
|
category is used to locate the catalogue file.
|
|
The results of setting this field to any other value
|
|
are undefined.
|
|
.P
|
|
\f4catclose\fP
|
|
closes the message catalogue identified by
|
|
.IR catd .
|
|
.SH "SEE ALSO"
|
|
\f4catgets\fP(3C), \f4setlocale\fP(3C), \f4environ\fP(5), \f4nl_types\fP(5).
|
|
.SH DIAGNOSTICS
|
|
If successful,
|
|
\f4catopen\fP
|
|
returns a message catalogue descriptor for use in
|
|
subsequent calls to
|
|
\f4catgets\fP
|
|
and
|
|
\f4catclose\fP.
|
|
Otherwise
|
|
\f4catopen\fP
|
|
returns
|
|
\f4(nl_catd) -1\fP.
|
|
.P
|
|
\f4catclose\fP
|
|
returns 0 if successful, otherwise \-1.
|