8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / man / man3c / addseverity.3c
blob2d005e36e0144c44324d2336f14248a8e54c86d5
1 '\" te
2 .\"  Copyright 1989 AT&T  Copyright (c) 1997, Sun Microsystems, Inc.  All Rights Reserved
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH ADDSEVERITY 3C "Dec 29, 1996"
7 .SH NAME
8 addseverity \- build a list of severity levels for an application for use with
9 fmtmsg
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <fmtmsg.h>
15 \fBint\fR \fBaddseverity\fR(\fBint\fR \fIseverity\fR, \fBconst char *\fR\fIstring\fR);
16 .fi
18 .SH DESCRIPTION
19 .sp
20 .LP
21 The \fBaddseverity()\fR function builds a list of severity levels for an
22 application to be used with the message formatting facility \fBfmtmsg()\fR. The
23 \fIseverity\fR argument is an integer value indicating the seriousness of the
24 condition. The \fIstring\fR argument is a pointer to a string describing the
25 condition (string is not limited to a specific size).
26 .sp
27 .LP
28 If \fBaddseverity()\fR is called with an integer value that has not been
29 previously defined, the function adds that new severity value and print string
30 to the existing set of standard severity levels.
31 .sp
32 .LP
33 If \fBaddseverity()\fR is called with an integer value that has been previously
34 defined, the function redefines that value with the new print string.
35 Previously defined severity levels may be removed by supplying the null string.
36 If \fBaddseverity()\fR is called with a negative number or an integer value of
37 0, 1, 2, 3, or 4, the function fails and returns \fB\(mi1\fR\&. The values
38 0\(mi4 are reserved for the standard severity levels and cannot be modified.
39 Identifiers for the standard levels of severity are:
40 .sp
41 .ne 2
42 .na
43 \fB\fBMM_HALT\fR\fR
44 .ad
45 .RS 14n
46 Indicates that the application has encountered a severe fault and is halting.
47 Produces the print string \fBHALT\fR.
48 .RE
50 .sp
51 .ne 2
52 .na
53 \fB\fBMM_ERROR\fR\fR
54 .ad
55 .RS 14n
56 Indicates that the application has detected a fault. Produces the print string
57 \fBERROR\fR.
58 .RE
60 .sp
61 .ne 2
62 .na
63 \fB\fBMM_WARNING\fR\fR
64 .ad
65 .RS 14n
66 Indicates a condition that is out of the ordinary, that might be a problem, and
67 should be watched. Produces the print string \fBWARNING\fR.
68 .RE
70 .sp
71 .ne 2
72 .na
73 \fB\fBMM_INFO\fR\fR
74 .ad
75 .RS 14n
76 Provides information about a condition that is not in error. Produces the print
77 string \fBINFO\fR.
78 .RE
80 .sp
81 .ne 2
82 .na
83 \fB\fBMM_NOSEV\fR\fR
84 .ad
85 .RS 14n
86 Indicates that no severity level is supplied for the message.
87 .RE
89 .sp
90 .LP
91 Severity levels may also be defined at run time using the \fBSEV_LEVEL\fR
92 environment variable (see \fBfmtmsg\fR(3C)).
93 .SH RETURN VALUES
94 .sp
95 .LP
96 Upon successful completion, \fBaddseverity()\fR returns \fBMM_OK\fR. Otherwise
97 it returns \fBMM_NOTOK\fR.
98 .SH EXAMPLES
99 .LP
100 \fBExample 1 \fRExample of \fBaddseverity()\fR function.
103 When the function call
106 .in +2
108 addseverity(7,"ALERT")
110 .in -2
114 is followed by the call
117 .in +2
119 fmtmsg(MM_PRINT, "UX:cat", 7, "invalid syntax", "refer to manual",
120 "UX:cat:001")
122 .in -2
126 the resulting output is
129 .in +2
131 UX:cat: ALERT: invalid syntax
132 TO FIX: refer to manual   UX:cat:001
134 .in -2
136 .SH ATTRIBUTES
139 See \fBattributes\fR(5) for descriptions of the following attributes:
144 box;
145 c | c
146 l | l .
147 ATTRIBUTE TYPE  ATTRIBUTE VALUE
149 MT-Level        Safe
152 .SH SEE ALSO
155 \fBfmtmsg\fR(1), \fBfmtmsg\fR(3C), \fBgettxt\fR(3C), \fBprintf\fR(3C),
156 \fBattributes\fR(5)