xref: /titanic_52/usr/src/man/man3c/addsev.3c (revision 7aa76ffc594f84c1c092911a84f85a79ddb44c73)
te
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]
addsev 3C "29 Dec 1996" "SunOS 5.11" "Standard C Library Functions"
NAME
addsev - define additional severities
SYNOPSIS

#include <pfmt.h>

int addsev(int int_val, const char *string);
DESCRIPTION

The addsev() function defines additional severities for use in subsequent calls to pfmt(3C) or lfmt(3C). It associates an integer value int_val in the range [5-255] with a character string, overwriting any previous string association between int_val and string.

If int_val is OR-ed with the flags argument passed to subsequent calls to pfmt() or lfmt(), string will be used as severity. Passing a null string removes the severity.

RETURN VALUES

Upon successful completion, addsev() returns 0. Otherwise it returns-1.

USAGE

Only the standard severities are automatically displayed for the locale in effect at runtime. An application must provide the means for displaying locale-specific versions of add-on severities. Add-on severities are only effective within the applications defining them.

EXAMPLES

Example 1 Example of addsev() function.

The following example

#define Panic 5
setlabel("APPL");
setcat("my_appl");
addsev(Panic, gettxt(":26", "PANIC"));
/* .\|.\|. */
lfmt(stderr, MM_SOFT|MM_APPL|PANIC, ":12:Cannot locate database\en");

will display the message to stderr and forward to the logging service

APPL: PANIC: Cannot locate database
ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
MT-LevelMT-safe
SEE ALSO

gettxt(3C), lfmt(3C), pfmt(3C), attributes(5)