HP-UX Reference (11i v2 07/12) - 3 Library Functions A-M (vol 6)
g
gettxt(3C) gettxt(3C)
(TO BE OBSOLETED)
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:
msgfilename:msgnumber
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
Message not found!!
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.
SEE ALSO
mkmsgs(1), setcat(3C), setlocale(3C), environ(5), thread_safety(5).
STANDARDS COMPLIANCE
gettxt(): SVID3
552 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: December 2007 Update