CATGETS(3C)

NAME
catgets, catgetmsg - get message from a message catalog

SYNOPSIS

#include <nl_types.h>

char *catgets(catd, set_num, msg_num, s)
nl_catd catd;
int set_num, msg_num;
char *s;

char *catgetmsg(catd, set_num, msg_num, buf, buflen)
nl_catd catd;
int set_num;
int msg_num;
int buflen;

DESCRIPTION

catgets() reads the message msg_num, in set set_num, from the message catalog identified by catd. catd is a catalog descriptor returned from an earlier call to catopen(3C). s points to a default message string which will be returned by catgets() if the identified message catalog is not currently available. The message-text is contained in an internal buffer area and should be copied by the application if it is to be saved or re-used after further calls to catgets().

catgetmsg() attempts to read up to buflen -1 bytes of a message string into the area pointed to by buf. buflen is an integer value containing the size in bytes of buf. The return string is always terminated with a null byte.

RETURN VALUES

On success, catgets() returns a pointer to an internal buffer area containing the null-terminated message string. catgets() returns a pointer to s if it fails because the message catalog specified by catd is not currently available. Otherwise, catgets() returns a pointer to an empty string if the message catalog is available but does not contain the specified message.

On success, catgetmsg() returns a pointer to the message string in buf. If catd is invalid or if set_num or msg_num is not in the message catalog, catgetmsg() returns a pointer to an empty string.

SEE ALSO
catopen(3C), locale(5)