1 .\" $NetBSD: fmtmsg.3,v 1.5 2003/04/16 13:34:36 wiz Exp $
3 .\" Copyright (c) 1999 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
30 .Dd September 10, 1999
35 .Nd format and display a message
41 .Fn fmtmsg "long classification" "const char *label" "int severity" "const char *text" "const char *action" "const char *tag"
45 function can be used to display messages in the specified format.
46 Messages may be written either to standard error, to the console, or both.
48 A formatted message consists of up to five components specified in
55 Further information such as the origin of the message, the recoverability
56 from the condition causing the message and where to display the message
62 argument consists of a major classification and several sub-classifications.
63 It has no effect on the content of the message displayed.
64 With the exception of the display sub-classification, only a single identifier
65 may be specified for each (sub-)classification.
66 The following classifications
68 .Bl -tag -width MessageXSourceXSub-classificationsXX
69 .It Major Classifications
70 The source of the condition.
71 Available identifiers are:
78 .It Message Source Sub-classifications
79 The type of software detecting the condition.
80 Available identifiers are:
87 .It Display Sub-classifications
88 The displays the formatted messages is to be written to.
89 Available identifiers are:
91 (standard error stream) and
94 .It Status Sub-classifications
95 The capability of the calling software to recover from the condition.
96 Available identifiers are:
111 argument identifies the source of the message.
112 It consists of two fields separated by a colon (:).
113 The first field is up to 10 characters, the second is up to 14 characters.
121 The seriousness of the condition causing the message.
124 levels are available:
125 .Bl -tag -width MM_WARNINGXX
127 The software has encountered a severe fault and is halting.
129 The software has encountered a fault.
131 The software has encountered an unusual non-fault condition.
133 The software informs about a non-error condition.
138 level is to be supplied,
142 The description of the condition the software encountered.
144 string is not limited to a specific size.
152 The first step to be taken to recover from the condition the software
153 encountered; it will be preceded by the prefix
155 The character string is not limited to a specific size.
163 The on-line documentation which provides further information about the
164 condition and the message, such as
166 The character string is not limited to a specific size.
174 Further effect on the formatting of the message as displayed on the
175 standard error stream (but not on the system console!) may be taken by
178 environment variable, which selects the subset of message components
180 It consists of a colon-separated list of the optional keywords
187 which correspond to the arguments to
192 is either not set or malformed (containing empty or unknown keywords),
193 its content is ignored an all message components will be selected.
195 Note that displaying a message on the system console may fail due to
196 inappropriate privileges or a non-permissive file mode of the console device.
200 function returns one of the following values:
201 .Bl -tag -width MM_NOTOKXXX
203 The function succeeded.
205 The function failed completely.
207 The function was unable to generate a message on standard error,
208 but otherwise succeeded.
210 The function was unable to generate a message on the console,
211 but otherwise succeeded.