HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)
f
fmtmsg(3C) fmtmsg(3C)
NAME
fmtmsg() - displays formatted message on standard error and console
SYNOPSIS
#include <fmtmsg.h>
int fmtmsg(
long class,
const char *label,
int severity,
const char *text,
const char *action,
const char *tag
);
DESCRIPTION
The fmtmsg() routine is intended as a language-independent error message service. Messages are
displayed on the system console, standard error, or both, depending on the setting of the class parameter.
The format of messages is under the control of the user, who may specify how much of the message is to be
displayed on standard error. However, the format of the message displayed to the system console is not
under user control.
All messages specify a class, which indicates the source and status of the error condition, and where the
message should be directed. The class may be functionally excluded by specifying
MM_NULLMC. If this is
done, no message is produced. The class types are:
Display The display class has allowable values of MM_PRINT, which directs the message
to standard error, MM_CONSOLE, which directs the message to the system con-
sole, or MM_PRINT | MM_CONSOLE , which directs the message to both.
Error Type The error type class may be one of MM_HARD, indicating a hardware error,
MM_SOFT, indicating a software failure, or MM_FIRM, which indicates a
firmware error.
Error Source The error source class may be one of MM_APPL, indicating an application,
MM_UTIL, indicating an OS utility, or MM_OPSYS, indicating a system error.
Recovery Status The recovery status class may be one of MM_RECOVER , indicating recovery from
the error is possible, or RMM_NRECOV , stating no recovery is possible.
The remaining parameters are functionally optional, in that the message produced may exclude any or all
of them. Each is discussed in parameter order.
The label component states where the error originated. It has the form major:minor, where major is a 10
character field specifying the major system producing the message and minor is a 14 character field specify-
ing the subsystem in error. For example,
mail:send
This component can be excluded by setting it to MM_NULLLBL or NULL.
The severity component describes the degree of importance of the failure. The predefined severity levels
are:
MM_NOSEV No severity is specified and no print string is generated.
MM_INFO The message is informational only and the INFO string is generated.
MM_WARNING The situation might be in error, and should be checked. The WARNING string is
generated.
MM_ERROR An error has been detected. The ERROR string is generated.
MM_HALT An unrecoverable error has been detected. The HALT string is generated.
The text component describes the nature of the failure in the most specific terms. It is expected to provide
a sufficiently detailed account of the error to remove all doubt about its cause. It may be excluded by set-
ting text to MM_NULLTXT or MM_NULL.
The action component describes the options available for recovery from the error. As output, it is prefaced
with the string TO FIX:. It may be disabled by setting action to MM_NULLACT or NULL.
HP-UX 11i Version 1: September 2005 − 1 − Hewlett-Packard Company Section 3−−273