Next: , Previous: The message catalog files, Up: Message catalogs a la X/Open


8.1.3 Generate Message Catalogs files

The gencat program is specified in the X/Open standard and the GNU implementation follows this specification and so processes all correctly formed input files. Additionally some extension are implemented which help to work in a more reasonable way with the catgets functions.

The gencat program can be invoked in two ways:

     `gencat [Option]... [Output-File [Input-File]...]`

This is the interface defined in the X/Open standard. If no Input-File parameter is given input will be read from standard input. Multiple input files will be read as if they are concatenated. If Output-File is also missing, the output will be written to standard output. To provide the interface one is used to from other programs a second interface is provided.

     `gencat [Option]... -o Output-File [Input-File]...`

The option ‘-o’ is used to specify the output file and all file arguments are used as input files.

Beside this one can use - or /dev/stdin for Input-File to denote the standard input. Corresponding one can use - and /dev/stdout for Output-File to denote standard output. Using - as a file name is allowed in X/Open while using the device names is a GNU extension.

The gencat program works by concatenating all input files and then merge the resulting collection of message sets with a possibly existing output file. This is done by removing all messages with set/message number tuples matching any of the generated messages from the output file and then adding all the new messages. To regenerate a catalog file while ignoring the old contents therefore requires to remove the output file if it exists. If the output is written to standard output no merging takes place.

The following table shows the options understood by the gencat program. The X/Open standard does not specify any option for the program so all of these are GNU extensions.

-V
--version
Print the version information and exit.
-h
--help
Print a usage message listing all available options, then exit successfully.
--new
Do never merge the new messages from the input files with the old content of the output files. The old content of the output file is discarded.
-H
--header=name
This option is used to emit the symbolic names given to sets and messages in the input files for use in the program. Details about how to use this are given in the next section. The name parameter to this option specifies the name of the output file. It will contain a number of C preprocessor #defines to associate a name with a number.

Please note that the generated file only contains the symbols from the input files. If the output is merged with the previous content of the output file the possibly existing symbols from the file(s) which generated the old output files are not in the generated header file.