msgcc(1) User Commands msgcc(1)NAME
msgcc - C language message catalog compiler
SYNOPSIS
msgcc [-M-option] [cc-optionsoption] file...
DESCRIPTION
msgcc is a C language message catalog compiler. It accepts cc style options and arguments.
A msgcpp(1) .mso file is generated for each input .c file. If the -c option is not specified then a gencat(1) format .msg file is generated
from the input .mso and .msg files. If -c is not specified then a .msg suffix is appended to the -o file if it doesn't already have a suf-
fix. The default output is a.out.msg if -c and -o are not specified.
If -M-new is not specified then messages are merged with those in the pre-existing -o file.
OPTIONS
The following options are supported:
cc-options Specify cc style options and arguments.
-M-option Set a msgcc option.
Specify option as one of the following:
mkmsgs The -o file is assumed to be in mkmsgs(1) format.
new Create a new -o file.
preserve Messages in the -o file that are not in new .msg file arguments are preserved. The default is to either re-
use the message numbers with new message text that is similar to the old or to delete the message text,
leaving an unused message number.
set=number Set the message set number to number. The default is 1.
similar=number The message text similarity message threshold. The similarity measure between old and new message text is:
100*(2*gzip(old+new)
/(gzip(old)+gzip(new))-1)
where gzip(x) is the size of text x when compressed by gzip. The default threshold is $__similar__$.A
threshold of 0 turns off message replacement, but unused old messages are still deleted. Use -M-preserve to
preserve all old messages.
verbose Trace similar message replacements on the standard error.
OPERANDS
The following operands are supported:
file Specifies the name of the file on which msgcc operates.
EXIT STATUS
0 Successful completion.
>0 An error occurred.
EXAMPLES
Example 1 Using msgcc
The following example uses msgcc to extract localizable strings from the file hello.c, marked using ERROR_dictionary(), writes them to the
file hello.mso, and creates a gencat format xxx.msg file:
example% cat hello.c
#include <stdio.h>
#include <stdlib.h>
/*
* dummy macro to avoid including
* libast headers
*/
#define ERROR_dictionary(x) x
int main(int ac, char *av[])
{
puts( ERROR_dictionary("hello world") );
return( EXIT_SUCCESS );
}
example% msgcc -o xxx -D__STDC__ -D__i386 hello.c
example% cat hello.mso
str "hello world"
example% cat xxx.msg
$ xxx message catalog
$translation msgcc 2007-09-25
$set 1
$quote "
1 "hello world"
AUTHORS
Glenn Fowler, gsf@research.att.com
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWastdev |
+-----------------------------+-----------------------------+
|Interface Stability |Volatile |
+-----------------------------+-----------------------------+
SEE ALSO cpp(1), gencat(1), mkmsgs(1), msggen(1), msgcpp(1), msgcvt(1), attributes(5)SunOS 5.11 9 Oct 2007 msgcc(1)
Check Out this Related Man Page
strmerge(1) General Commands Manual strmerge(1)NAME
strmerge - batch string replacement
SYNOPSIS
strmerge [-m prefix] [-p patternfile] [-s string] source-program...
OPTIONS
Add prefix to message numbers in the output source program and source message catalog. You can use this prefix as a mnemonic. You must
process source message catalogs that contain number prefixes using the mkcatdefs command. Message numbers will be in the form:
<prefix><msg_num>
Set numbers will be in the form:
S_<prefix><set_num>
If you process your input source program with the mkcatdefs command, the resulting source program and source message catalog might
not be portable. For more information, see the Writing Software for the International Market. Use patternfile to match strings in
the input source program. By default, the command searches for the pattern file in the current directory, your home directory and
finally /usr/lib/nls.
If you omit the -p option, the strmerge command uses a default patterns file that is stored in /usr/lib/nls/patterns. Write string
at the top of the source message catalog. If you omit the -s option, strmerge uses the string specified in the $CATHEAD section of
the patterns file.
DESCRIPTION
The strmerge command reads the strings specified in the message file produced by strextract and replaces those strings with calls to the
message file in the source program to create a new source program. The new version of source program has the same name as the input source
program, with the prefix nl_. For example, if the input source program is named prog.c, the output source program is named nl_prog.c. You
use this command to replace hard-coded messages (text strings identified by the strextract command) with calls to the catgets function and
to create a source message catalog file. The source message catalog contains the text for each message extracted from your input source
program. The strmerge command names the file by appending to the name of the input source program. For example, the source message catalog
for the prog.c program is named prog.msg. You can use the source message catalog as input to the gencat command.
At run time, the program reads the message text from the message catalog. By storing messages in a message catalog, instead of your pro-
gram, you allow the text of messages to be translated to a new language or modified without the source program being changed.
In the source-program argument, you name one or more source programs for which you want strings replaced. The strmerge command does not
replace messages for source programs included using the #include directive. Therefore, you might want a source program and all the source
programs it includes on a single strmerge command line.
You can create a patterns file (as specified by patternfile ) to control how the strmerge command replaces text. The patterns file is
divided into several sections, each of which is identified by a keyword. The keyword must start at the beginning of a new line, and its
first character must be a dollar sign ($). Following the identifier, you specify a number of patterns. Each pattern begins on a new line
and follows the regular expression syntax you use in the ed editor. For more information on the patterns file, see the patterns(4) refer-
ence page.
RESTRICTIONS
You can specify only one rewrite string for all classes of pattern matches.
The strmerge command does not verify if the message text file matches the source file being rewritten.
The strmerge command does not replace strings to files included with #include directive. You must run the strmerge command on these files
separately.
EXAMPLES
The following produces a message file prog.cat for a program called prog.c.
% strextract -p c_patterns prog.c prog2.c % vi prog.str % strmerge -p c_patterns prog.c prog2.c % gencat prog.cat prog.msg prog2.msg % vi
nl_prog.c % vi nl_prog2.c % cc nl_prog.c nl_prog2.c
In this example, the strextract command uses the c_patterns file to determine which strings to match. The input source programs are named
prog.c and prog2.c.
If you need to remove any of the messages or extract one of the created strings, edit the resulting message file, prog.str. Under no condi-
tions should you add to this file. Doing so could result in unpredictable behavior.
You issue the strmerge command to replace the extracted strings with calls to the message catalog. In response to this command, strmerge
creates the source message catalogs, prog.msg and prog2.msg, and the output source programs, nl_prog.c and nl_prog2.c.
Before compiling the source programs, you must edit nl_prog.c and nl_prog2.c to include the appropriate catopen and catclose function
calls.
The gencat command creates a message catalog and the cc command creates an executable program.
SEE ALSO extract(1), gencat(1), strextract(1), trans(1), regexp(3), catopen(3), catgets(3), patterns(4)
Writing Software for the International Market
strmerge(1)