Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ catopen(3C) — HP-UX 9.10

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

catgets(3C)

environ(5)

catopen(3C)

NAME

catopen(), catclose() − open and close a message catalog for reading

SYNOPSIS

#include <nl_types.h>

nl_catd catopen(const char *name, int oflag);

int catclose(nl_catd catd);

DESCRIPTION

catopen() opens a message catalog and returns a catalog descriptor.  name specifies the name of the message catalog being opened.  A name containing a slash (/) specifies a path name for the message catalog.  Otherwise, the environment variable NLSPATH is used (see environ(5)). If NLSPATH specifies more than one path, catopen() returns the catalog descriptor for the first path on which it is able to successfully open the specified message catalog.  If NLSPATH does not exist in the environment, or if a message catalog cannot be opened for any NLSPATH-specified path, catopen() uses a system-wide default path.  The default is affected by the setting of LANG.  name must not contain %N. 

A message catalog descriptor remains valid in a process until the process closes it, or until a successful call to one of the exec() functions.  A change in the setting of LANG category has no effect on existing open catalogs. 

If a file descriptor is used to implement message catalog descriptors, the FD_CLOEXEC flag will be set; see <fcntl.h>. 

oflag is reserved for future use and should be set to zero (0).  The results of setting this field to any other value are undefined. 

catclose() closes the message catalog catd, a message catalog descriptor returned from an earlier successful call to catopen(). 

RETURN VALUE

catopen() returns a message catalog descriptor if successful.  Otherwise, a value of (nl_catd)−1 is returned and errno is set to indicate the error. 

catclose() returns 0 if successful.  Otherwise, −1 is returned and errno is set to indicate the error. 

ERRORS

catopen() fails, no message catalog is opened, and errno is set for the last path attempted if any of the following conditions is true:

[ENOTDIR] A component of the path prefix is not a directory. 

[ENOENT] The named catalog does not exist. 

[ENOENT] The path is null. 

[EACCES] A component of the path prefix denies search permission. 

[EACCES] Read permission is denied for the named file. 

[EMFILE] The maximum number of file descriptors allowed are currently open. 

[ENAMETOOLONG] The length of the specified path name exceeds PATH_MAX bytes, or the length of a component of the path name exceeds NAME_MAX bytes while _POSIX_NO_TRUNC is in effect. 

[ENFILE] The system file table is  full. 

[ENOTDIR] A component of the path prefix is not a directory. 

catclose() fails if the following is true:

[EBADF] catd is not a valid open message-catalog descriptor. 

WARNINGS

When using NLSPATH, catopen() does not provide a default value for LANG. 

NOTES

catgets() can be used to provide default messages when called following a failed catopen() (see catgets(3C)). catgets() returns its def_str parameter if it is passed an invalid catalog descriptor. 

AUTHOR

catopen() was developed by HP. 

FILES

/usr/lib/nls Message catalog default path. 

SEE ALSO

catgets(3C), environ(5), <fcntl.h>, <nl_types.h>. 

STANDARDS CONFORMANCE

catopen(): AES, XPG2, XPG3, XPG4

catclose(): AES, XPG2, XPG3, XPG4

Hewlett-Packard Company  —  HP-UX Release 9.10: April 1995

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026