| Current File : //usr/man/man3c/addsev.3c |
'\" te
.\" Copyright 1989 AT&T Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved
.TH addsev 3C "29 Dec 1996" "SunOS 5.11" "Standard C Library Functions"
.SH NAME
addsev \- define additional severities
.SH SYNOPSIS
.LP
.nf
#include <pfmt.h>
\fBint\fR \fBaddsev\fR(\fBint\fR \fIint_val\fR, \fBconst char *\fR\fIstring\fR);
.fi
.SH DESCRIPTION
.sp
.LP
The \fBaddsev()\fR function defines additional severities for use in subsequent calls to \fBpfmt\fR(3C) or \fBlfmt\fR(3C). It associates an integer value \fIint_val\fR in the range [5-255] with a character \fIstring\fR, overwriting any previous string association between \fIint_val\fR and \fIstring\fR.
.sp
.LP
If \fIint_val\fR is OR-ed with the \fIflags\fR argument passed to subsequent calls to \fBpfmt()\fR or \fBlfmt()\fR, \fIstring\fR will be used as severity. Passing a null \fIstring\fR removes the severity.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBaddsev()\fR returns \fB0\fR. Otherwise it returns\fB\(mi1\fR\&.
.SH USAGE
.sp
.LP
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.
.SH EXAMPLES
.LP
\fBExample 1 \fRExample of \fBaddsev()\fR function.
.sp
.LP
The following example
.sp
.in +2
.nf
#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");
.fi
.in -2
.sp
.LP
will display the message to \fIstderr\fR and forward to the logging service
.sp
.in +2
.nf
APPL: PANIC: Cannot locate database
.fi
.in -2
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
MT-LevelMT-safe
.TE
.SH SEE ALSO
.sp
.LP
\fBgettxt\fR(3C), \fBlfmt\fR(3C), \fBpfmt\fR(3C), \fBattributes\fR(5)