summaryrefslogtreecommitdiff
path: root/usr/src/man/man1/fmtmsg.1
blob: 4dc5a9f1a7e9a23d1fc0c291ce32508301bb5417 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 1994, Sun Microsystems, Inc.  All Rights Reserved
.\" 2003, Sun Microsystems, Inc.  All Rights Reserved
.\" 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.
.\" 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.
.\" 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]
.TH FMTMSG 1 "Jul 20, 1994"
.SH NAME
fmtmsg \- display a message on stderr or system console
.SH SYNOPSIS
.LP
.nf
\fBfmtmsg\fR [\fB-c\fR \fIclass\fR] [\fB-u\fR \fIsubclass\fR] [\fB-l\fR \fIlabel\fR] [\fB-s\fR \fIseverity\fR]
     [\fB-t\fR \fItag\fR] [\fB-a\fR \fIaction\fR] \fItext\fR
.fi

.SH DESCRIPTION
.sp
.LP
Based on a message's classification component, the \fBfmtmsg\fR utility either
writes a formatted message to \fBstderr\fR or writes a formatted message to the
console.
.sp
.LP
A formatted message consists of up to five standard components (see environment
variable \fBMSGVERB\fR in the ENVIRONMENT VARIABLES section of this page). The
classification and subclass components are not displayed as part of the
standard message, but rather define the source of the message and direct the
display of the formatted message.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-c\fR \fIclass\fR \fR
.ad
.RS 16n
Describes the source of the message. Valid keywords are:
.sp
.ne 2
.na
\fB\fBhard\fR \fR
.ad
.RS 9n
The source of the condition is hardware.
.RE

.sp
.ne 2
.na
\fB\fBsoft\fR \fR
.ad
.RS 9n
The source of the condition is software.
.RE

.sp
.ne 2
.na
\fB\fBfirm\fR \fR
.ad
.RS 9n
The source of the condition is firmware.
.RE

.RE

.sp
.ne 2
.na
\fB\fB-u\fR \fIsubclass\fR \fR
.ad
.RS 16n
A list of keywords (separated by commas) that further defines the message and
directs the display of the message. Valid keywords are:
.sp
.ne 2
.na
\fB\fBappl\fR \fR
.ad
.RS 12n
The condition originated in an application. This keyword should not be used in
combination with either \fButil\fR or \fBopsys\fR.
.RE

.sp
.ne 2
.na
\fB\fButil\fR \fR
.ad
.RS 12n
The condition originated in a utility. This keyword should not be used in
combination with either \fBappl\fR or \fBopsys\fR.
.RE

.sp
.ne 2
.na
\fB\fBopsys\fR \fR
.ad
.RS 12n
The message originated in the kernel. This keyword should not be used in
combination with either \fBappl\fR or \fButil\fR.
.RE

.sp
.ne 2
.na
\fB\fBrecov\fR \fR
.ad
.RS 12n
The application will recover from the condition. This keyword should not be
used in combination with \fBnrecov\fR.
.RE

.sp
.ne 2
.na
\fB\fBnrecov\fR \fR
.ad
.RS 12n
The application will not recover from the condition. This keyword should not be
used in combination with \fBrecov\fR.
.RE

.sp
.ne 2
.na
\fB\fBprint\fR \fR
.ad
.RS 12n
Print the message to the standard error stream \fBstderr\fR.
.RE

.sp
.ne 2
.na
\fB\fBconsole\fR \fR
.ad
.RS 12n
Write the message to the system console. \fBprint\fR, \fBconsole\fR, or both
may be used.
.RE

.RE

.sp
.ne 2
.na
\fB\fB-l\fR \fIlabel\fR \fR
.ad
.RS 16n
Identifies the source of the message.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR \fIseverity\fR \fR
.ad
.RS 16n
Indicates the seriousness of the error. The keywords and definitions of the
standard levels of \fIseverity\fR are:
.sp
.ne 2
.na
\fB\fBhalt\fR \fR
.ad
.RS 9n
The application has encountered a severe fault and is halting.
.RE

.sp
.ne 2
.na
\fB\fBerror\fR\fR
.ad
.RS 9n
The application has detected a fault.
.RE

.sp
.ne 2
.na
\fB\fBwarn\fR\fR
.ad
.RS 9n
The application has detected a condition that is out of the ordinary and might
be a problem.
.RE

.sp
.ne 2
.na
\fB\fBinfo\fR \fR
.ad
.RS 9n
The application is providing information about a condition that is not in
error.
.RE

.RE

.sp
.ne 2
.na
\fB\fB-t\fR \fItag\fR \fR
.ad
.RS 16n
The string containing an identifier for the message.
.RE

.sp
.ne 2
.na
\fB\fB-a\fR \fIaction\fR \fR
.ad
.RS 16n
A text string describing the first step in the error recovery process. This
string must be written so that the entire \fIaction\fR argument is interpreted
as a single argument. \fBfmtmsg\fR precedes each action string with the \fBTO
FIX:\fR prefix.
.RE

.sp
.ne 2
.na
\fB\fItext\fR \fR
.ad
.RS 16n
A text string describing the condition. Must be written so that the entire
\fItext\fR argument is interpreted as a single argument.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRStandard message format
.sp
.LP
The following example of \fBfmtmsg\fR produces a complete message in the
standard message format and displays it to the standard error stream.

.sp
.in +2
.nf
example% \fBfmtmsg -c soft -u recov,print,appl -l UX:cat \e
     -s error -t UX:cat:001 -a "refer to manual" "invalid syntax"\fR
.fi
.in -2
.sp

.sp
.LP
produces:

.sp
.in +2
.nf
UX:cat: ERROR: invalid syntax
TO FIX: refer to manual   UX:cat:138
.fi
.in -2
.sp

.LP
\fBExample 2 \fRUsing MSGVERB
.sp
.LP
When the environment variable \fBMSGVERB\fR is set as follows:

.sp
.in +2
.nf
\fBMSGVERB=severity:text:action\fR
.fi
.in -2
.sp

.sp
.LP
and Example 1 is used, \fBfmtmsg\fR produces:

.sp
.in +2
.nf
ERROR: invalid syntax
TO FIX: refer to manual
.fi
.in -2
.sp

.LP
\fBExample 3 \fRUsing SEV_LEVEL
.sp
.LP
When the environment variable \fBSEV_LEVEL\fR is set as follows:

.sp
.in +2
.nf
\fBSEV_LEVEL=note,5,NOTE\fR
.fi
.in -2
.sp

.sp
.LP
the following \fBfmtmsg\fR command:

.sp
.in +2
.nf
example% \fBfmtmsg -c soft -u print -l UX:cat -s note \e
     -a "refer to manual" "invalid syntax"\fR
.fi
.in -2
.sp

.sp
.LP
produces:

.sp
.in +2
.nf
NOTE: invalid syntax
TO FIX: refer to manual
.fi
.in -2
.sp

.sp
.LP
and displays the message on \fBstderr\fR.

.SH ENVIRONMENT VARIABLES
.sp
.LP
The environment variables \fBMSGVERB\fR and \fBSEV_LEVEL\fR control the
behavior of \fBfmtmsg\fR. \fBMSGVERB\fR is set by the administrator in the
\fB/etc/profile\fR for the system. Users can override the value of
\fBMSGVERB\fR set by the system by resetting \fBMSGVERB\fR in their own
\fB\&.profile\fR files or by changing the value in their current shell session.
\fBSEV_LEVEL\fR can be used in shell scripts.
.sp
.LP
\fBMSGVERB\fR tells \fBfmtmsg\fR which message components to select when
writing messages to \fBstderr\fR. The value of \fBMSGVERB\fR is a
colon-separated list of optional keywords. \fBMSGVERB\fR can be set as follows:
.sp
.in +2
.nf
\fBMSGVERB=[\fIkeyword\fR[:\fIkeyword\fR[:...]]]
export MSGVERB\fR
.fi
.in -2
.sp

.sp
.LP
Valid \fIkeyword\fRs are: \fBlabel\fR, \fBseverity\fR, \fBtext\fR,
\fBaction\fR, and \fBtag\fR. If \fBMSGVERB\fR contains a keyword for a
component and the component's value is not the component's null value,
\fBfmtmsg\fR includes that component in the message when writing the message to
\fBstderr\fR. If \fBMSGVERB\fR does not include a keyword for a message
component, that component is not included in the display of the message. The
keywords may appear in any order. If \fBMSGVERB\fR is not defined, if its value
is the null string, if its value is not of the correct format, or if it
contains keywords other than the valid ones listed above, \fBfmtmsg\fR selects
all components.
.sp
.LP
\fBMSGVERB\fR affects only which message components are selected for display.
All message components are included in console messages.
.sp
.LP
\fBSEV_LEVEL\fR defines severity levels and associates print strings with them
for use by \fBfmtmsg\fR. The standard severity levels shown below cannot be
modified. Additional severity levels can be defined, redefined, and removed.
.sp
.ne 2
.na
\fB\fB0\fR \fR
.ad
.RS 6n
(no severity is used)
.RE

.sp
.ne 2
.na
\fB\fB1\fR \fR
.ad
.RS 6n
\fBHALT\fR
.RE

.sp
.ne 2
.na
\fB\fB2\fR \fR
.ad
.RS 6n
\fBERROR\fR
.RE

.sp
.ne 2
.na
\fB\fB3\fR \fR
.ad
.RS 6n
\fBWARNING\fR
.RE

.sp
.ne 2
.na
\fB\fB4\fR \fR
.ad
.RS 6n
\fBINFO\fR
.RE

.sp
.LP
\fBSEV_LEVEL\fR is set as follows:
.sp
.LP
\fIdescription\fR is a comma-separated list containing three fields:
.sp
.in +2
.nf
\fBSEV_LEVEL=   [\fIdescription\fR[:\fIdescription\fR[:...]]]
export SEV_LEVEL\fR
.fi
.in -2
.sp

.sp
.LP
\fIdescription\fR=\fIseverity_keyword\fR, \fIlevel\fR, \fIprintstring\fR
.sp
.LP
\fIseverity_keyword\fR is a character string used as the keyword with the
\fB-s\fR \fIseverity\fR option to \fBfmtmsg\fR.
.sp
.LP
\fIlevel\fR is a character string that evaluates to a positive integer (other
than \fB0\fR, \fB1\fR, \fB2\fR, \fB3\fR, or \fB4\fR, which are reserved for the
standard severity levels). If the keyword \fIseverity_keyword\fR is used,
\fIlevel\fR is the severity value passed on to \fBfmtmsg\fR(3C).
.sp
.LP
\fIprintstring\fR is the character string used by \fBfmtmsg\fR in the standard
message format whenever the severity value \fIlevel\fR is used.
.sp
.LP
If \fBSEV_LEVEL\fR is not defined, or if its value is null, no severity levels
other than the defaults are available. If a \fIdescription\fR in the colon
separated list is not a comma separated list containing three fields, or if the
second field of a comma separated list does not evaluate to a positive integer,
that \fIdescription\fR in the colon separated list is ignored.
.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR \fR
.ad
.RS 7n
All the requested functions were executed successfully.
.RE

.sp
.ne 2
.na
\fB\fB1\fR \fR
.ad
.RS 7n
The command contains a syntax error, an invalid option, or an invalid argument
to an option.
.RE

.sp
.ne 2
.na
\fB\fB2\fR \fR
.ad
.RS 7n
The function executed with partial success, however the message was not
displayed on \fBstderr\fR.
.RE

.sp
.ne 2
.na
\fB\fB4\fR \fR
.ad
.RS 7n
The function executed with partial success; however, the message was not
displayed on the system console.
.RE

.sp
.ne 2
.na
\fB\fB32\fR \fR
.ad
.RS 7n
No requested functions were executed successfully.
.RE

.SH SEE ALSO
.sp
.LP
\fBaddseverity\fR(3C), \fBfmtmsg\fR(3C), \fBattributes\fR(5)