2 .\" Copyright 1989 AT&T Copyright (c) 1994, Sun Microsystems, Inc. All Rights Reserved
3 .\" 2003, Sun Microsystems, Inc. All Rights Reserved
4 .\" 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.
5 .\" 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.
6 .\" 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]
7 .TH FMTMSG 1 "Jul 20, 1994"
9 fmtmsg \- display a message on stderr or system console
13 \fBfmtmsg\fR [\fB-c\fR \fIclass\fR] [\fB-u\fR \fIsubclass\fR] [\fB-l\fR \fIlabel\fR] [\fB-s\fR \fIseverity\fR]
14 [\fB-t\fR \fItag\fR] [\fB-a\fR \fIaction\fR] \fItext\fR
20 Based on a message's classification component, the \fBfmtmsg\fR utility either
21 writes a formatted message to \fBstderr\fR or writes a formatted message to the
25 A formatted message consists of up to five standard components (see environment
26 variable \fBMSGVERB\fR in the ENVIRONMENT VARIABLES section of this page). The
27 classification and subclass components are not displayed as part of the
28 standard message, but rather define the source of the message and direct the
29 display of the formatted message.
33 The following options are supported:
37 \fB\fB-c\fR \fIclass\fR \fR
40 Describes the source of the message. Valid keywords are:
47 The source of the condition is hardware.
56 The source of the condition is software.
65 The source of the condition is firmware.
73 \fB\fB-u\fR \fIsubclass\fR \fR
76 A list of keywords (separated by commas) that further defines the message and
77 directs the display of the message. Valid keywords are:
84 The condition originated in an application. This keyword should not be used in
85 combination with either \fButil\fR or \fBopsys\fR.
94 The condition originated in a utility. This keyword should not be used in
95 combination with either \fBappl\fR or \fBopsys\fR.
104 The message originated in the kernel. This keyword should not be used in
105 combination with either \fBappl\fR or \fButil\fR.
114 The application will recover from the condition. This keyword should not be
115 used in combination with \fBnrecov\fR.
124 The application will not recover from the condition. This keyword should not be
125 used in combination with \fBrecov\fR.
134 Print the message to the standard error stream \fBstderr\fR.
143 Write the message to the system console. \fBprint\fR, \fBconsole\fR, or both
152 \fB\fB-l\fR \fIlabel\fR \fR
155 Identifies the source of the message.
161 \fB\fB-s\fR \fIseverity\fR \fR
164 Indicates the seriousness of the error. The keywords and definitions of the
165 standard levels of \fIseverity\fR are:
172 The application has encountered a severe fault and is halting.
181 The application has detected a fault.
190 The application has detected a condition that is out of the ordinary and might
200 The application is providing information about a condition that is not in
209 \fB\fB-t\fR \fItag\fR \fR
212 The string containing an identifier for the message.
218 \fB\fB-a\fR \fIaction\fR \fR
221 A text string describing the first step in the error recovery process. This
222 string must be written so that the entire \fIaction\fR argument is interpreted
223 as a single argument. \fBfmtmsg\fR precedes each action string with the \fBTO
233 A text string describing the condition. Must be written so that the entire
234 \fItext\fR argument is interpreted as a single argument.
239 \fBExample 1 \fRStandard message format
242 The following example of \fBfmtmsg\fR produces a complete message in the
243 standard message format and displays it to the standard error stream.
248 example% \fBfmtmsg -c soft -u recov,print,appl -l UX:cat \e
249 -s error -t UX:cat:001 -a "refer to manual" "invalid syntax"\fR
261 UX:cat: ERROR: invalid syntax
262 TO FIX: refer to manual UX:cat:138
268 \fBExample 2 \fRUsing MSGVERB
271 When the environment variable \fBMSGVERB\fR is set as follows:
276 \fBMSGVERB=severity:text:action\fR
283 and Example 1 is used, \fBfmtmsg\fR produces:
288 ERROR: invalid syntax
289 TO FIX: refer to manual
295 \fBExample 3 \fRUsing SEV_LEVEL
298 When the environment variable \fBSEV_LEVEL\fR is set as follows:
303 \fBSEV_LEVEL=note,5,NOTE\fR
310 the following \fBfmtmsg\fR command:
315 example% \fBfmtmsg -c soft -u print -l UX:cat -s note \e
316 -a "refer to manual" "invalid syntax"\fR
329 TO FIX: refer to manual
336 and displays the message on \fBstderr\fR.
338 .SH ENVIRONMENT VARIABLES
341 The environment variables \fBMSGVERB\fR and \fBSEV_LEVEL\fR control the
342 behavior of \fBfmtmsg\fR. \fBMSGVERB\fR is set by the administrator in the
343 \fB/etc/profile\fR for the system. Users can override the value of
344 \fBMSGVERB\fR set by the system by resetting \fBMSGVERB\fR in their own
345 \fB\&.profile\fR files or by changing the value in their current shell session.
346 \fBSEV_LEVEL\fR can be used in shell scripts.
349 \fBMSGVERB\fR tells \fBfmtmsg\fR which message components to select when
350 writing messages to \fBstderr\fR. The value of \fBMSGVERB\fR is a
351 colon-separated list of optional keywords. \fBMSGVERB\fR can be set as follows:
355 \fBMSGVERB=[\fIkeyword\fR[:\fIkeyword\fR[:...]]]
363 Valid \fIkeyword\fRs are: \fBlabel\fR, \fBseverity\fR, \fBtext\fR,
364 \fBaction\fR, and \fBtag\fR. If \fBMSGVERB\fR contains a keyword for a
365 component and the component's value is not the component's null value,
366 \fBfmtmsg\fR includes that component in the message when writing the message to
367 \fBstderr\fR. If \fBMSGVERB\fR does not include a keyword for a message
368 component, that component is not included in the display of the message. The
369 keywords may appear in any order. If \fBMSGVERB\fR is not defined, if its value
370 is the null string, if its value is not of the correct format, or if it
371 contains keywords other than the valid ones listed above, \fBfmtmsg\fR selects
375 \fBMSGVERB\fR affects only which message components are selected for display.
376 All message components are included in console messages.
379 \fBSEV_LEVEL\fR defines severity levels and associates print strings with them
380 for use by \fBfmtmsg\fR. The standard severity levels shown below cannot be
381 modified. Additional severity levels can be defined, redefined, and removed.
388 (no severity is used)
429 \fBSEV_LEVEL\fR is set as follows:
432 \fIdescription\fR is a comma-separated list containing three fields:
436 \fBSEV_LEVEL= [\fIdescription\fR[:\fIdescription\fR[:...]]]
444 \fIdescription\fR=\fIseverity_keyword\fR, \fIlevel\fR, \fIprintstring\fR
447 \fIseverity_keyword\fR is a character string used as the keyword with the
448 \fB-s\fR \fIseverity\fR option to \fBfmtmsg\fR.
451 \fIlevel\fR is a character string that evaluates to a positive integer (other
452 than \fB0\fR, \fB1\fR, \fB2\fR, \fB3\fR, or \fB4\fR, which are reserved for the
453 standard severity levels). If the keyword \fIseverity_keyword\fR is used,
454 \fIlevel\fR is the severity value passed on to \fBfmtmsg\fR(3C).
457 \fIprintstring\fR is the character string used by \fBfmtmsg\fR in the standard
458 message format whenever the severity value \fIlevel\fR is used.
461 If \fBSEV_LEVEL\fR is not defined, or if its value is null, no severity levels
462 other than the defaults are available. If a \fIdescription\fR in the colon
463 separated list is not a comma separated list containing three fields, or if the
464 second field of a comma separated list does not evaluate to a positive integer,
465 that \fIdescription\fR in the colon separated list is ignored.
469 The following exit values are returned:
476 All the requested functions were executed successfully.
485 The command contains a syntax error, an invalid option, or an invalid argument
495 The function executed with partial success, however the message was not
496 displayed on \fBstderr\fR.
505 The function executed with partial success; however, the message was not
506 displayed on the system console.
515 No requested functions were executed successfully.
521 \fBaddseverity\fR(3C), \fBfmtmsg\fR(3C), \fBattributes\fR(5)