HP-UX Reference (11i v3 07/02) - 1 User Commands A-M (vol 1)

m
mkcatdefs(1) mkcatdefs(1)
See the EXAMPLES section for an illustration of techniques that provide insulation from changes in how
numeric constants are mapped to symbolic identifiers for message sets and messages.
EXTERNAL INFLUENCES
Environment Variables
LANG provides a default value for the internationalization variables that are unset or null. If
LANG is
unset or null, it defaults to
C
(see lang(5)).
LC_ALL, when set to a non-empty string value, overrides the values of all other internationalization vari-
ables.
LC_MESSAGES determines the language in which error messages are displayed.
EXAMPLES
The following example shows a message source file that contains one message set and uses a mix of sym-
bolic and numeric identifiers for messages:
$quote " Use a double quotation mark to delimit message text
$set MSFAC Message Facility - symbolic identifiers
SYM_FORM "Symbolic identifiers can contain only letters \
and digits and the _ (underscore character)\n"
5 "You can mix symbolic identifiers and numbers \n"
$quote
MSG_H Remember to include the "_msg.h" file in your program\n
In this example, the $quote command sets the quote character to " (double quote), then disables it before
the last message, which contains double quotes.
When you process the file with mkcatdefs , the modified source is written to standard output. Standard
output can either be redirected to a file using the > redirection symbol or piped to
gencat.
Assume that the preceding file is named
symb.src. It can be processed with mkcatdefs as follows:
$
mkcatdefs symb symb.src >symb.msg
The symb.msg file contains the following preprocessed message source code:
$quote " Use a double quotation mark to delimit message text
$ delset 1
$set 1 Message Facility - symbolic identifiers
1 "Symbolic identifiers can contain only letters \
and digits and the _ (underscore character)\n"
5 "You can mix symbolic identifiers and numbers \n"
$quote
6 Remember to include the "_msg.h" file in your program\n
Note that the assigned message numbers are noncontiguous because the symb.src file contained the specific
message number 5. The mkcatdefs program always assigns the previous number plus 1 to the next sym-
bolic identifier.
The generated symb_msg.h file contains the following:
#ifndef _H_SYMB_MSG
#define _H_SYMB_MSG
#include <limits.h>
#include <nl_types.h>
#define MF_SYMB "symb"
/* The following was generated from symb.src. */
/* definitions for set MSFAC */
#define MSFAC 1
#define SYM_FORM 1
#define MSG_H 6
#endif
658 Hewlett-Packard Company 3 HP-UX 11i Version 3: February 2007