Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dspmsg(1) [hpux man page]

dspmsg(1)						      General Commands Manual							 dspmsg(1)

NAME
dspmsg - display a selected message from a message catalog SYNOPSIS
| set_number] catalog_name message_number ['default_string' [argument ... ]] DESCRIPTION
The command displays a particular message from a message catalog. The display may include a message identifier, depending on the presence of the or option and settings for the and environment variables. A message identifier consists of one of more of the following items: the catalog name, the set number, and the message number. See the subsection below for more information about these environment variables. Options The command recognizes the following options: Specifies that message identifiers be displayed along with message strings, but only for those message sets specified by the or environment variables. You can override the default format of the message identifier by defining the or environment variable. See the sub- section for more information. Specifies that the message identifier is displayed for messages in all message sets under control of the environment variable. If you use this option, the environment variables have no effect. However, you must explicitly define one of the environment variables to display the message identifiers. When you use this option, if the message catalog is not found and the default_string argument is omitted, the message identifier is displayed by itself. For example, will be displayed if the catalog_name is and the message_number is and the set_number is Specifies the set number. If not specified, searches for messages in the first message set. Operands The command recognizes the following operands: catalog_name Specifies the name of a message catalog. By default searches for the catalog in the set of directories specified by the environment variable and then in the current directory. The search can be disabled by prefixing a path name to the catalog. For more information about see environ(5). message_number Specifies the message number in the specified set. If the option is omitted, only searches for the message in the first message set in the catalog. default_string Specifies the message for the command to display if cannot find a message with the specified number in the catalog. If the message includes the notation for message inserts, either enclose the default message in single quotes or escape the character in the insertion notation argument ... Specifies arguments (up to 10) to be inserted in the catalog message or default message if it contains either the or the conversion specifications. You must include the default_string argument in order to specify message insertion arguments. You must specify the message catalog (catalog_name) and the message (message_number). You must also specify the message set (set_number) if the catalog has more than one message set and the specified message is not in the first set. The command displays the default_string value if the specified message is not found in the catalog or the catalog cannot be found or opened. Usually default_string is identical to the message in the catalog, except for the language in which the text is printed. If you do not specify default_string, displays nothing if the message cannot be retrieved from the catalog. The following example displays message number 2 in set 3 of test.cat: If does not find the specified message in the catalog or cannot find or open the catalog, it displays the string "Sorry, that item is no longer in stock." Using Symbolic Names for Default Message Strings When the utility preprocesses a message source file, it can create a file that defines macros or variables for default message strings. When this file is included in a shell script or program, can specify a symbolic name for the default_string argument. In the following example the file containing default message strings created by is first sourced in the POSIX shell. Then the command is invoked using the name of one of these variables as the default message string. dspmsg -s 3 store.cat 2 "${STORE_SOLDOUT}" The store_msg.sh file was created by the utility and defines the STORE_SOLDOUT variable to be the string "Sorry, that item is no longer in stock." The utility created the variable name by prepending the prefix (STORE_) that was specified with the option to the symbolic name for the message (SOLDOUT). See mkcatdefs(1) for more information about creating include files that define symbolic names for default mes- sage strings. Displaying Message Identifiers with Messages The command displays a message by itself or preceded by its message identifier. Display of message identifiers is enabled by one of the following: 1) The option, which must be combined with a setting for the or environment variable and can be combined with a setting of the envi- ronment variable. The catname is the name of the message catalog file in uppercase and without the ".cat" extension. It over- rides the environment variable, if defined. 2) The option, which must be combined with a setting for the environment variable and is not affected by settings of the environment variables. Display of message identifiers is disabled under any of the following conditions: 1) For the option: o The and environment variables are not defined. o The value of the or (if that variable is not defined) the value of the environment variable does not include the message set containing the message. o The value of the or (if that variable is not set) the value of the environment variable is set to "", that is, NULL. 2) For the option: The and environment variables are not defined. 3) For the and options: The value of the or (if that variable is not defined) the value of the environment variable is set to "", that is, NULL. Message identifiers are made up of some combination of the catalog name, set identifier, message identifier, and delimiting characters. Following are some examples of message identifiers you can display by using the options and environment variables discussed in this man- page: o o The first example illustrates the default format for message identifiers if you use the option and do not set one of the environment vari- ables. The second example illustrates what happens when you use the option and set the to "", that is, the catalog name followed by a space followed by the message number. The following subsections discuss the and environment variables in more detail. Using the CAT_MIDSET* Environment Variables The and environment variables are used to control how to activate the message identifier feature. You can use them to specify a space-sep- arated list of numeric identifiers for the sets containing messages that will be displayed with message identifiers. For example, if you set one of these variables to "3 4", only messages in sets 3 and 4 will have their message identfiers displayed. The messages in other sets in the message catalog will be displayed without their message identifiers. If you set one of these variables to "", this will dis- able display of message identifiers for all sets in the message catalog. The command checks for the and environment variables only when the option is specified. When this option is specified, first determines if the environment variable is set. If it is set, and message_number is in one of the sets specified by the variable, precedes the specified message with its message identifier. If a catalog-specific environment variable is not set, searches for the environment variable and uses its setting. If neither environment variable is set, does not display message identifiers. Usually, application programmers want to display message identifiers only for messages that are warning or error conditions. If a message catalog is well designed, messages associated with these conditions reside in different sets from those containing informational messages or background text strings. You can set the environment variable to list only the message sets that contain warnings or errors and then use to confine display of message identifiers to those kinds of messages. Using the CAT_MIDFMT* Environment Variables The and environment variables control the format of the message identifier. One of these environment variables must be defined to enable display of identifiers with the option. These variables can be defined to override the default format used for identifiers displayed through the option. The command first checks the catalog-specific environment variable and then, if the catalog-specific version is not found, checks for the environment variable. The value of the environment variables can include one or more of the following substitution directives (in any order): The message catalog name without the file extension. The identifier for the message set. This is the numeric constant identifier. The message identifier. This is the numeric constant identifier. The default format. If specified first in the format string, the default format (""). If not specified first in the format string, the substitu- tion directive is ignored. The format can include additional ASCII characters, such as the space or colon, as delimiters between segments of the identifier. However, you cannot include the percent character as a delimiter because of its special meaning to the shell. Following are some example formats and resulting message identifiers and strings. Assume for these examples that the catalog name is du, the message set identifier is 3, the message identifier is 2, and the message string is "Out of memory". o "" du/3/2: Out of memory o "" du/3/2: Out of memory o "" du-2: Out of memory o "" du 2: Out of memory EXTERNAL INFLUENCES
Environment Variables provides a default value for the internationalization variables that are unset or null. If is unset or null, it defaults to (see lang(5)). when set to a non-empty string value, overrides the values of all other internationalization variables. determines the language in which messages are displayed. determines the path to be used for searching the specified message catalog file. It affects how the internationalization variables are being used in locating the desired message catalog. EXAMPLES
To display message number 2 in set number 1 of test.cat, enter: If the message does not exist in the set, the string "Default Message" will be displayed. AUTHOR
The command was developed by OSF and HP. SEE ALSO
dspcat(1), gencat(1), mkcatdefs(1), catclose(3C), catgets(3C), catopen(3C). dspmsg(1)
Man Page