1addseverity(3C) Standard C Library Functions addseverity(3C)
2
3
4
6 addseverity - build a list of severity levels for an application for
7 use with fmtmsg
8
10 #include <fmtmsg.h>
11
12 int addseverity(int severity, const char *string);
13
14
16 The addseverity() function builds a list of severity levels for an
17 application to be used with the message formatting facility fmtmsg().
18 The severity argument is an integer value indicating the seriousness of
19 the condition. The string argument is a pointer to a string describing
20 the condition (string is not limited to a specific size).
21
22
23 If addseverity() is called with an integer value that has not been pre‐
24 viously defined, the function adds that new severity value and print
25 string to the existing set of standard severity levels.
26
27
28 If addseverity() is called with an integer value that has been previ‐
29 ously defined, the function redefines that value with the new print
30 string. Previously defined severity levels may be removed by supplying
31 the null string. If addseverity() is called with a negative number or
32 an integer value of 0, 1, 2, 3, or 4, the function fails and returns
33 −1. The values 0−4 are reserved for the standard severity levels and
34 cannot be modified. Identifiers for the standard levels of severity
35 are:
36
37 MM_HALT Indicates that the application has encountered a severe
38 fault and is halting. Produces the print string HALT.
39
40
41 MM_ERROR Indicates that the application has detected a fault. Pro‐
42 duces the print string ERROR.
43
44
45 MM_WARNING Indicates a condition that is out of the ordinary, that
46 might be a problem, and should be watched. Produces the
47 print string WARNING.
48
49
50 MM_INFO Provides information about a condition that is not in
51 error. Produces the print string INFO.
52
53
54 MM_NOSEV Indicates that no severity level is supplied for the mes‐
55 sage.
56
57
58
59 Severity levels may also be defined at run time using the SEV_LEVEL
60 environment variable (see fmtmsg(3C)).
61
63 Upon successful completion, addseverity() returns MM_OK. Otherwise it
64 returns MM_NOTOK.
65
67 Example 1 Example of addseverity() function.
68
69
70 When the function call
71
72
73 addseverity(7,"ALERT")
74
75
76
77 is followed by the call
78
79
80 fmtmsg(MM_PRINT, "UX:cat", 7, "invalid syntax", "refer to manual",
81 "UX:cat:001")
82
83
84
85 the resulting output is
86
87
88 UX:cat: ALERT: invalid syntax
89 TO FIX: refer to manual UX:cat:001
90
91
93 See attributes(5) for descriptions of the following attributes:
94
95
96
97
98 ┌─────────────────────────────┬─────────────────────────────┐
99 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
100 ├─────────────────────────────┼─────────────────────────────┤
101 │MT-Level │Safe │
102 └─────────────────────────────┴─────────────────────────────┘
103
105 fmtmsg(1), fmtmsg(3C), gettxt(3C), printf(3C), attributes(5)
106
107
108
109SunOS 5.11 29 Dec 1996 addseverity(3C)