FMTMSG(3) | Library Functions Manual | FMTMSG(3) |
fmtmsg
—
#include <fmtmsg.h>
int
fmtmsg
(long
classification, const
char *label, int
severity, const char
*text, const char
*action, const char
*tag);
fmtmsg
() function can be used to display messages in
the specified format. Messages may be written either to standard error, to the
console, or both.
A formatted message consists of up to five components specified in label, severity, text, action and tag. Further information such as the origin of the message, the recoverability from the condition causing the message and where to display the message is specified in classification.
MM_HARD
(hardware),
MM_SOFT
(software), and
MM_FIRM
(firmware).MM_APPL
(application),
MM_UTIL
(utility), and
MM_OPSYS
(operating system).MM_PRINT
(standard error stream)
and MM_CONSOLE
(system console).MM_RECOVER
(recoverable) and MM_NRECOV
(non-recoverable).If no classification is to be supplied,
MM_NULLMC
must be specified.
If no label is to be supplied,
MM_NULLLBL
must be specified.
MM_HALT
MM_ERROR
MM_WARNING
MM_INFO
If no severity level is to be supplied,
MM_NOSEV
must be specified.
If no text is to be supplied,
MM_NOTXT
must be specified.
If no action is to be supplied,
MM_NOACT
must be specified.
If no tag is to be supplied,
MM_NOTAG
must be specified.
Further effect on the formatting of the message as displayed on
the standard error stream (but not on the system console!) may be taken by
setting the MSGVERB
environment variable, which
selects the subset of message components to be printed. It consists of a
colon-separated list of the optional keywords label,
severity, text,
action, and tag, which
correspond to the arguments to fmtmsg
() with the
same names. If MSGVERB
is either not set or
malformed (containing empty or unknown keywords), its content is ignored an
all message components will be selected.
Note that displaying a message on the system console may fail due to inappropriate privileges or a non-permissive file mode of the console device.
fmtmsg
() function returns one of the following
values:
fmtmsg
() function conforms to
X/Open System Interfaces and Headers Issue 5
(“XSH5”).
April 11, 2011 | NetBSD 9.2 |