gencat(1) gencat(1)
NAME
gencat - generate a binary encoded message catalog
SYNOPSIS
gencat [option ...] catfile msgfile ...
DESCRIPTION
The gencat utility merges the contents of a message text source file
into a binary encoded message catalog.
The message catalog is created if it does not already exist. If it
does exist, its messages are included in the new message catalog. If
the set numbers and message numbers of existing and newly defined mes-
sage texts match, gencat replaces the old message texts currently con-
tained in the message catalog with the new message texts defined in
the message text file.
Message catalogs produced by gencat are binary encoded, which means
that their portability cannot be guaranteed between different types of
machine. Thus, just as C programs need to be recompiled for each type
of machine, message catalogs must be recreated with gencat.
A message text source file can contain either set and message numbers
or simply message numbers. In the later case, the set NLSETD is
assumed for the set numbers.
OPTIONS
The options -m and -X are mutually exclusive; the last option set
takes precedence.
-l If catfile already exists, information on messages contained in it
will be written to standard output in the following format:
With the -X option:
SET setnum, MESSAGE msgnum, TEXT msgtxt
*
Without the -X option:
SET setnum, MESSAGE msgnum, OFFSET offset, LENGTH msglen messagetext
*
offset indicates the distance from the beginning of the file to the
start of the message text, i.e.
first message: offset(1) = 0
nth message: offset(n) = offset(n-1) + msglen(n)
Page 1 Reliant UNIX 5.44 Printed 11/98
gencat(1) gencat(1)
-m The -m option ensures compliance with the X/Open standard.
The -m option is supplied for compatibility with previous versions
of gencat released in a number of specialized internationalization
products. This option will cause gencat to build a single file
catfile which is compatible with the format catalogs produced by
the earlier versions. The retrieval routines detect the type of
catalog they are using and act appropriately.
The -m option corresponds to the default behavior of gencat and
need not be explicitly set.
-X gencat builds upon the mkmsgs utility. The gencat database
comprises two files: catfile.m, which is an mkmsgs format catalog,
and catfile, which contains the information required to translate a
set and message number into a simple message number that can be
used in a call to gettxt.
gettxt expects the catalogs to be located in a subdirectory under
/usr/lib/locale. This restriction is lifted by placing a symbolic
link to the catalog in the directory /usr/lib/locale/Xopen/LCMESSAGES
when the catalog is opened. This link enables gettxt to access the
catalog. The link is removed when the catalog is closed.
-- End of the list of options. Must be specified if catfile begins
with -.
No option specified:
gencat behaves as described under the -m option.
catfile
Name of the binary encoded message catalog that gencat is to gen-
erate from the message text file msgfile. If a dash (-) is speci-
fied for catfile, gencat prints to standard output.
msgfile
Name of the message text file that was generated by extract(1).
gencat generates a binary encoded message catalog from this file.
If a dash (-) is specified for msgfile, gencat reads from standard
input. More than one message text file may be specified.
FORMAT OF A MESSAGE CATALOG
A message catalog created by gencat contains the following structures
in the given order:
⊕ The catalog header, CATHDR, consisting of:
- the file's magic number
- the number of sets in the message file
Page 2 Reliant UNIX 5.44 Printed 11/98
gencat(1) gencat(1)
- the space (in bytes) needed to load the file, excluding the
length of the file header
- the position at which the message headers begin, excluding the
length of the file header
- the position at which the message texts begin, excluding the
length of the file header
⊕ A set header, CATSETHDR, for each existing set. This header con-
sists of:
- the set number
- the number of messages in the set
- the initial offset in the table
⊕ A message header, CATMSGHDR, for each existing message. This
header consists of:
- the message number
- the length of the message in bytes
- the message offset in the table
⊕ The individual message texts, delimited by \0.
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If LCMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
The LCALL environment variable governs the entire locale. LCALL
takes precedence over all the other environment variables which affect
internationalization.
EXAMPLES
Generating a binary encoded message catalog catfile from the message
text file msgfile, which was generated earlier with extract(1).
$ gencat catfile msgfile
SEE ALSO
dumpmsg(1), extract(1), iconv(1), mkmsgs(1), catclose(3C),
catgets(3C), catopen(3C), gettxt(3C), nltypes(5).
Programmer's Guide: Internationalization - Localization.
Page 3 Reliant UNIX 5.44 Printed 11/98