Syntax | #include <fmtmsg.h> int fmtmsg(long classification, const char *label, int severity, const char *text, const char *action, const char *tag); | |||||||||||||||||||||||||||||
Description | Building on the classification component of a message,
A formatted message consists of up to five standard components which are defined below. The classification component is not part of the standard message that is shown to the user; instead, it defines the message source and controls the display of the formatted message.. | |||||||||||||||||||||||||||||
classification | ||||||||||||||||||||||||||||||
| contains identifiers from the following groups of main and secondary classifications. Every identifier of a subclass can be used with a single identifier of a different subclass via inclusive OR. With the exception of the display classification, two or more identifiers from the same subclass should not be used together. Both identifiers of the display classification can be used such that the messages appear on both Major classifications identify the origin of a status. The identifiers are: Message source subclassifications identify the type of software in which the problem occurred. The identifiers are: Display subclassifications identify where the message is to be displayed. The identifiers are Status subclassifications indicate whether the application program can recover after the status. Identifiers are: Additional identifier indicates that no classification component is specified for the message. | |||||||||||||||||||||||||||||
label | defines the origin of the message. The format of this component consists of two fields separated by a colon. The first field is up to 10 characters long; the second is up to 14 characters long. It is advisable to mark the package and the program or the application name with label. For example, the content | |||||||||||||||||||||||||||||
severity | indicates the severity level of the status. Identifiers for the severity levels are:
| |||||||||||||||||||||||||||||
| text | describes the cause of the message. The text string is not limited to a particular length. If the string is empty, the text that is output is undefined. | ||||||||||||||||||||||||||||
| action | describes the first action to be executed in the error recovery process. | ||||||||||||||||||||||||||||
| tag | An identifier that refers to the online documentation for the message. It is recommended that tag contain the origin of the message addressed via label and a unique number. An example of tag is | ||||||||||||||||||||||||||||
| Environment variablesThere are two environment variables which influence the behavior of
Valid keywords are: At the first call of
0 (no severity level used) 1 HALT 2 ERROR 3 WARNING 4 INFO
description contains a list with three fields, each separated by a comma: description severity_keyword is a string that is used as the keyword for the option level is a string containing a positive integer (not 0, 1, 2, 3 or 4 because these values are reserved for the standard severity levels). If the keyword severity_keyword is used, level represents the severity level of the value that was passed to the printstring is a string that is used by If in the list description does not represent a list of three fields separated by commas, or if the second field of a list is not an integer, description is ignored in the list. When | |||||||||||||||||||||||||||||
Return val. |
| if successful. | ||||||||||||||||||||||||||||
. |
| The function has completely failed. | ||||||||||||||||||||||||||||
. |
| The function could not generate a message via the standard error output, but was otherwise successful. | ||||||||||||||||||||||||||||
|
| The function could not generate a message via the system console, but was otherwise successful. | ||||||||||||||||||||||||||||
Notes | One or more message components can be systematically omitted from the message if the null value of the respective components is specified.
A further means of systematic omission of a component consists of leaving out the keywords of the component when defining the | |||||||||||||||||||||||||||||
Example 1 |
returns a complete message with the standard message format:
| |||||||||||||||||||||||||||||
Example 2 | If the
and example 1 is then used,
| |||||||||||||||||||||||||||||
Example 3 | If the
the following
returns the following output:
| |||||||||||||||||||||||||||||
See also |
|