mkcatdefs.1 (2010 09)

m
mkcatdefs(1) mkcatdefs(1)
Explicitly specifying a catalog-specific prefix is recommended if programs and
scripts access multiple message catalogs. Otherwise, there is a risk that the include
files generated for the different catalogs might define the same symbol for different
message strings. The mkcatdefs command returns an error if symbolic names
are not unique within the same catalog; however, multiple symbol definitions that
result from including multiple include files causes compiler warnings or display of
the wrong message string at run time.
The
mkcatdefs command sends message source data to standard output. This output is suitable as
input to the gencat program. You can use the right angle bracket (
>) character to write the prepro-
cessed message source code to a file, and then use this file as input to the
gencat command.
Each message set and message in program source code must have a unique number or symbolic name.
You can enable use of these symbolic identifiers in a program by including them in the message source file
input to the
mkcatdefs command. Symbolic identifiers can contain English letters, digits, and under-
scores; however, the first character cannot be a digit or an underscore. The
mkcatdefs command con-
verts symbolic names specified in the message source file to numeric constants. One restriction is that
mkcatdefs does not convert symbolic names included in a
$delset command. Therefore, if your mes-
sage source file contains
$delset commands to delete message sets, those commands must identify the
sets to be deleted by their numeric constant identifiers.
The
mkcatdefs program is designed to create new message catalogs, not to change existing ones incre-
mentally. The sets specified in source_file are assigned numbers in ascending order, starting at 1. Within
each set, messages are also assigned numbers in ascending order, starting at 1. If you explicitly assign a
message to a number in your source_file , mkcatdefs continues its ascending series with that number.
Restrictions
Symbolic identifiers for message sets, messages, and default message strings are an ease-of-maintenance
feature for program source code and shell scripts; however, symbolic references are a proprietary exten-
sion to the XSH standard and might not be supported on all systems conforming to this standard.
Symbolic identifiers for message sets and messages provide ease of maintenance by reducing the need to
change references in program source code when a catalog is revised. However, use of symbolic identifiers
does not insulate a program from run-time problems if it uses the catgets() function to retrieve mes-
sages from a catalog, the catalog is revised, and the program is not recompiled with a new version of the
catname _msg.h file. That is because the XSH standard constrains the run-time behavior of catgets()
to the use of numeric identifiers, and the numeric constants mapped to the symbolic identifiers can
change when a message catalog is rebuilt.
The mappings of numeric constants to symbols change if the following kinds of revisions were made to the
corresponding message source file (or files) and a catalog is rebuilt:
New message sets were added before or between existing message sets.
Message sets, other than the last one in the file, were deleted.
Existing message sets were rearranged.
New messages were added before or between existing messages in a given message set.
Messages, other than the last one, in a message set were deleted.
Existing messages were rearranged within a message set.
The message catalog was built from multiple message source files and the order in which these
files were specified on the
mkcatdefs command line was changed.
Therefore, if these kinds of changes were made to message source code and a catalog was rebuilt, pro-
grams must be recompiled with a version of catname _msg.h that was generated from the revised message
source file or files.
If care is taken to maintain the ordinal position of existing message sets and messages when the message
source file is changed (assuming, of course, that program source code is not changed to refer to any new
or deleted message sets and messages), recompilation with a revised version of catname _msg.h is not
necessary.
Symbolic names for message sets and messages must be unique across all message sets included in the
catalog. By implication, this also means that these symbolic names must be unique across all message
source files specified as input to the
mkcatdefs command.
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010