DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

addseverity(S-osr5)


addseverity -- build a list of severity levels for an application, for use with fmtmsg

Syntax

cc ...-lc

#include <fmtmsg.h>

int addseverity(int severity, const char *string);

Description

addseverity(S-osr5) builds a list of severity levels for an application to use with the message formatting facility, fmtmsg(S-osr5). severity is an integer value indicating the seriousness of the condition, and string is a pointer to a string describing the condition. (The string is not limited to a specific size.)

If addseverity( ) is called with an integer value that has not been defined yet, it adds that new severity value and print string to the set of standard severity levels.

If addseverity( ) is called with an integer value that has been previously defined, it redefines that value with the new print string.

You can remove previously defined severity levels by supplying a null string.

The values 0-4 are reserved for the standard severity levels and cannot be modified.

If addseverity( ) is called with a negative number or an integer value of 0, 1, 2, 3, or 4, the function fails and returns -1.

Identifiers for the standard levels of severity are:


MM_NOSEV
indicates that no severity level is supplied for the message.

MM_INFO
provides information about a condition that is not in error. It produces the print string INFO.

MM_WARNING
indicates a condition that is out of the ordinary, that might be a problem, and should be watched. It produces the print string WARNING.

MM_ERROR
indicates that the application has detected a fault. It produces the print string ERROR.

MM_HALT
indicates that the application has encountered a severe fault and is halting. It produces the print string HALT.
You can also define severity levels at run time by using the environment variable SEV_LEVEL (see fmtmsg( )).

Future releases

The functions pfmt(S-osr5) and addsev(S-osr5) are being introduced as the replacements for fmtmsg( ) and addseverity( ), which will be removed in the future. pfmt( ) and addsev( ) have a slightly different standard error message format and new developer interfaces.

Return values

addseverity( ) returns MM_OK on success or MM_NOTOK on failure.

Diagnostics

This function does not set errno.

Examples

When the function addseverity( ) is used as follows:
   addseverity(7,"ALERT")
the following call to fmtmsg( ):
   fmtmsg(MM_PRINT, "SCO:cat", 7, "invalid syntax",
   	"refer to manual", "SCO:cat:001")
produces:
   SCO:cat: ALERT: invalid syntax
   TO FIX: refer to manual   SCO:cat:001

See also

fmtmsg(S-osr5), gettxt(S-osr5), printf(S-osr5)

Standards conformance

addseverity(S-osr5) is not part of any currently supported standard; it was developed by UNIX System Laboratories, Inc. and is maintained by The SCO Group.
© 2005 System Services (S-osr5)
SCO OpenServer Release 6.0.0 -- 02 June 2005