NAME
gettxt() — read text string from message file
SYNOPSIS
#include <unistd.h>
char *gettxt(char *msg_id, char *def_str);
DESCRIPTION
The
gettxt()
routine retrieves a text string from a message file for the current locale.
msg_id
has the following syntax:
where
msgfilename
is the name of the message file generated by
mkmsgs(1).
If
msgfilename
is
NULL,
gettxt()
uses the message file specified in the last call to
setcat(3C).
msgnumber
is the sequence number of the text string in the message file
(the sequence begins at 1).
gettxt()
returns the message
under any of the following conditions:
msgfilename
is an invalid message catalog name.
No catalog is specified in
msg_id
or through
setcat(3C).
msgnumber
is not a positive number.
No message could be retrieved and
def_str
is
NULL.
EXTERNAL INFLUENCES
Environment Variables
gettxt()
uses the environment variable
LC_MESSAGES
to determine the locale to use to search for the
msgfilename
message file.
If
LC_MESSAGES
is not set, the environment variable
LANG
is used.
If
LANG
is not set, the "C" locale will be used.
The user can also change the locale via the
setlocale(3C)
routine.
If the
msgfilename
message file is not found in the specified locale or if the
msgnumber
is out of bounds,
gettxt()
attempts to retrieve the text string from the "C" locale.
def_str
is the string returned if a text string cannot be retrieved even from
the "C" locale.
EXAMPLES
The following code fragments are equivalent:
gettxt("mytest:1", "my default message");
setcat("mytest");
gettxt(":1", "my default message");
WARNINGS
Obsolescent Interfaces
gettxt()
is to be obsoleted at a future date.
STANDARDS COMPLIANCE
gettxt(): SVID3