Copyright 1989 AT&T Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
#include <fmtmsg.h> int addseverity(int severity, const char *string);
The addseverity() function builds a list of severity levels for an application to be used with the message formatting facility fmtmsg(). The severity argument is an integer value indicating the seriousness of the condition. The string argument is a pointer to a string describing the condition (string is not limited to a specific size).
If addseverity() is called with an integer value that has not been previously defined, the function adds that new severity value and print string to the existing set of standard severity levels.
If addseverity() is called with an integer value that has been previously defined, the function redefines that value with the new print string. Previously defined severity levels may be removed by supplying the null string. 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. The values 0-4 are reserved for the standard severity levels and cannot be modified. Identifiers for the standard levels of severity are: MM_HALT
Indicates that the application has encountered a severe fault and is halting. Produces the print string HALT.
Indicates that the application has detected a fault. Produces the print string ERROR.
Indicates a condition that is out of the ordinary, that might be a problem, and should be watched. Produces the print string WARNING.
Provides information about a condition that is not in error. Produces the print string INFO.
Indicates that no severity level is supplied for the message.
Severity levels may also be defined at run time using the SEV_LEVEL environment variable (see fmtmsg(3C)).
Upon successful completion, addseverity() returns MM_OK. Otherwise it returns MM_NOTOK.
Example 1 Example of addseverity() function.
When the function call
addseverity(7,"ALERT")
is followed by the call
fmtmsg(MM_PRINT, "UX:cat", 7, "invalid syntax", "refer to manual", "UX:cat:001")
the resulting output is
UX:cat: ALERT: invalid syntax TO FIX: refer to manual UX:cat:001
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE |
MT-Level Safe |
fmtmsg(1), fmtmsg(3C), gettxt(3C), printf(3C), attributes(5)