.PM ""
'\"macro stdmacro
.if n .pH g3c.addseverity @(#)addseverity @(#)addseverity	40.14
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} addseverity 3C "Essential Utilities" "\&"
.if \nX=1 .ds x} addseverity 3C "Essential Utilities"
.if \nX=2 .ds x} addseverity 3C "" "\&"
.if \nX=3 .ds x} addseverity "" "" "\&"
.TH \*(x}
.SH NAME
\f4addseverity\f1 \- build a list of severity levels for an application for use with \f4fmtmsg\f1
.SH SYNOPSIS
\f4#include <fmtmsg.h>\fP
.PP
\f4int addseverity(int severity, const char \(**string);\fP
.SH DESCRIPTION
The \f4addseverity\f1 function builds a list of
severity levels for an application to be used with the message formatting
facility, \f4fmtmsg\f1.
\f2severity\f1 is an integer value indicating the
seriousness of the condition, and
\f2string\f1 is a pointer to a string describing the condition
(string is not limited to a specific size). 
.PP
If \f4addseverity\f1 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.
.P
If \f4addseverity\f1 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 \f4NULL\f1 string.
If \f4addseverity\f1 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:
.RS
.TP 14
\f4MM_HALT\fP
indicates that the application has
encountered a severe fault and is halting.
Produces the print string \f5HALT\fP.
.TP
\f4MM_ERROR\fP
indicates that the application has detected a fault.
Produces the print string \f5ERROR\fP.
.TP
\f4MM_WARNING\fP
indicates a condition that is out of the ordinary,
that might be a problem, and should be watched.
Produces the print string \f5WARNING\fP.
.TP
\f4MM_INFO\fP
provides information about a condition that is not in error.
Produces the print string \f5INFO\fP.
.TP
\f4MM_NOSEV\fP
indicates that no severity level is supplied for the message.
.RE
.PD
.PP
Severity levels may also be defined at run time
using the \f4SEV_LEVEL\f1 environment variable
[see \f4fmtmsg\f1(3C)].
.SH EXAMPLES
When the function \f4addseverity\f1 is used as follows:
.sp .25
.RS
\f4addseverity(7,"ALERT")\fP
.RE
.sp .25
the following call to \f4fmtmsg\f1:
.sp .25
.RS
\f4fmtmsg(MM_PRINT, "UX:cat", 7, "invalid syntax",
"refer to manual", "UX:cat:001")\fP
.RE
.sp .25
produces:
.sp .25
.RS
\f5UX:cat: ALERT: invalid syntax
.br
TO FIX: refer to manual   UX:cat:001\fP
.RE
.SH SEE ALSO
\f4fmtmsg\fP(1M), \f4fmtmsg\fP(3C), \f4gettxt\fP(3C), \f4printf\fP(3S).
.SH DIAGNOSTICS
\f4addseverity\f1
returns
\f4MM_OK\f1 on success
or
\f4MM_NOTOK\f1
on failure.
