Synopsis

Description

The genmsg utility extracts message strings with calls to catgets(3C) from source
files and writes them in a format suitable for input to gencat(1).

Invocation

genmsg reads one or more input files and, by default, generates a
message source file whose name is composed of the first input file
name with .msg. If the -o option is specified, genmsg uses the
option argument for its output file.

Command

Output File

genmsg prog.c

prog.c.msg

gensmg main.c util.c tool.c

main.c.msg

genmsg -o prog.msg mail.c util.c

prog.msg

genmsg also allows you to invoke a preprocessor to solve the dependencies
of macros and define statements for the catgets(3C) calls.

Auto Message Numbering

genmsg replaces message numbers with the calculated numbers based upon the project
file if the message numbers are -1, and it generates copies of
the input files with the new message numbers and a copy of
the project file with the new maximum message numbers.

A project file is a database that stores a list of set
numbers with their maximum message numbers. Each line in a project file
is composed of a set number and its maximum message number:

Set_number

Maximum_message_number

In a project file, a line beginning with a number sign (#)
or an ASCII space is considered as a comment and ignored.

genmsg also has the reverse operation to replace all message numbers with
-1.

Comment Extraction

genmsg allows you to comment about messages and set numbers to inform
the translator how the messages should be translated. It extracts the comment,
which is surrounded with the comment indicators and has the specified tag
inside the comment, from the input file and writes it with a dollar
($) prefix in the output file. genmsg supports the C and C++
comment indicators, '/*', '*/', and '//'.

Testing

genmsg generates two kinds of messages for testing, prefixed messages and long
messages. Prefixed messages allow you to check that your program is retrieving
the messages from the message catalog. Long messages allow you to check
the appearance of your window program's initial size and position.

Options

The following options are supported:

-a

Append the output into the message file message-file that is specified by the -o option. If two different messages that have the same set and message number are found, the message in the specified message file is kept and the other message in the input file is discarded.

-b

Place the extracted comment after the corresponding message in the output file. This option changes the placement behavior of the -s or -c option.

-c message-tag

Extract message comments having message-tag inside them from the input files and write them with a '$' prefix as a comment in the output file.

-d

Include an original text of a message as a comment to be preserved along with its translations. With this option, the translator can see the original messages even after they are replaced with their translations.

-f

Overwrite the input files and the project file when used with the -l or -r option. With the -r option, genmsg overwrites only the input files.

-g project-file

Generate project-file that has a list of set numbers and their maximum message numbers in the input files.

-l project-file

Replace message numbers with the calculated numbers based upon project-file if the message numbers are -1 in the input files, and then generate copies of the input files with the new message numbers and a copy of project-file with the new maximum message numbers. If project-file is not found, genmsg uses the maximum message number in the input file as a base number and generates project-file.

-m prefix

Fill in the message with prefix. This option is useful for testing.

-M suffix

Fill in the message with suffix. This option is useful for testing.

-n

Add comment lines to the output file indicating the file name and line number in the input files where each extracted string is encountered.

-o message-file

Write the output to message-file.

-p preprocessor

Invoke preprocessor to preprocess macros and define statements for the catgets(3C) calls. genmsg first invokes the option argument as a preprocesser and then starts the normal process against the output from the preprocessor. genmsg initiates this process for all the input files.

-r

Replace message numbers with -1. This is the reverse operation of the -l option.

-s set-tag

Extract set number comments having set-tag inside them from the input files and write them with a '$' prefix as a comment in the output file. If multiple comments are specified for one set number, the first one is extracted and the rest of them are discarded.

-t

Generate a message that is three times as long as the original message. This option is useful for testing.

-x

Suppress warning messages about message and set number range checks and conflicts.

When the auto message numbering is turned on with a preprocessor, if
there are multiple -1's in the catgets(3C) line, genmsg replaces all of
the -1's in the line with a calculated number. For example, given
the input: