fmtmsg - display a message in the specified format on standard error and/or a system console
#include <fmtmsg.h>
int fmtmsg(long classification, const char *label,
int severity,
const char *text, const char *action,
const char
*tag);
The fmtmsg() function shall display messages in a specified format instead of the traditional printf() function.
Based on a message's classification component, fmtmsg() shall write a formatted message either to standard error, to the console, or to both.
A formatted message consists of up to five components as defined below. The component classification is not part of a message displayed to the user, but defines the source of the message and directs the display of the formatted message.
Identifies the source of the condition. Identifiers are: MM_HARD (hardware), MM_SOFT (software), and MM_FIRM (firmware).
Identifies the type of software in which the problem is detected. Identifiers are: MM_APPL (application), MM_UTIL (utility), and MM_OPSYS (operating system).
Indicates where the message is to be displayed. Identifiers are: MM_PRINT to display the message on the standard error stream, MM_CONSOLE to display the message on the system console. One or both identifiers may be used.
Indicates whether the application can recover from the condition. Identifiers are: MM_RECOVER (recoverable) and MM_NRECOV (non-recoverable).
An additional identifier, MM_NULLMC, indicates that no classification component is supplied for the message.
The MSGVERB environment variable (for message verbosity) shall determine for fmtmsg() which message components it is to select when writing messages to standard error. The value of MSGVERB shall be a colon-separated list of optional keywords. Valid keywords are: label, severity, text, action, and tag. If MSGVERB contains a keyword for a component and the component's value is not the component's null value, fmtmsg() shall include that component in the message when writing the message to standard error. If MSGVERB does not include a keyword for a message component, that component shall not be included in the display of the message. The keywords may appear in any order. If MSGVERB is not defined, if its value is the null string, if its value is not of the correct format, or if it contains keywords other than the valid ones listed above, fmtmsg() shall select all components.
MSGVERB shall determine which components are selected for display to standard error. All message components shall be included in console messages.
The fmtmsg() function shall return one of the following values:
None.
The following sections are informative.
The following example of fmtmsg():
fmtmsg(MM_PRINT, "XSI:cat", MM_ERROR, "illegal option", "refer to cat in user's reference manual", "XSI:cat:001")
produces a complete message in the specified message format:
XSI:cat: ERROR: illegal option TO FIX: refer to cat in user's reference manual XSI:cat:001
When the environment variable MSGVERB is set as follows:
MSGVERB=severity:text:action
and Example 1 is used, fmtmsg() produces:
ERROR: illegal option TO FIX: refer to cat in user's reference manual
One or more message components may be systematically omitted from messages generated by an application by using the null value of the argument for that component.
printf() , the Base Definitions volume of IEEE Std 1003.1-2001, <fmtmsg.h>
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |