1fmtmsg(1) User Commands fmtmsg(1)
2
3
4
6 fmtmsg - display a message on stderr or system console
7
9 fmtmsg [-c class] [-u subclass] [-l label] [-s severity]
10 [-t tag] [-a action] text
11
12
14 Based on a message's classification component, the fmtmsg utility
15 either writes a formatted message to stderr or writes a formatted mes‐
16 sage to the console.
17
18
19 A formatted message consists of up to five standard components (see
20 environment variable MSGVERB in the ENVIRONMENT VARIABLES section of
21 this page). The classification and subclass components are not dis‐
22 played as part of the standard message, but rather define the source of
23 the message and direct the display of the formatted message.
24
26 The following options are supported:
27
28 -c class Describes the source of the message. Valid keywords
29 are:
30
31 hard The source of the condition is hardware.
32
33
34 soft The source of the condition is software.
35
36
37 firm The source of the condition is firmware.
38
39
40
41 -u subclass A list of keywords (separated by commas) that further
42 defines the message and directs the display of the mes‐
43 sage. Valid keywords are:
44
45 appl The condition originated in an application.
46 This keyword should not be used in combina‐
47 tion with either util or opsys.
48
49
50 util The condition originated in a utility. This
51 keyword should not be used in combination
52 with either appl or opsys.
53
54
55 opsys The message originated in the kernel. This
56 keyword should not be used in combination
57 with either appl or util.
58
59
60 recov The application will recover from the con‐
61 dition. This keyword should not be used in
62 combination with nrecov.
63
64
65 nrecov The application will not recover from the
66 condition. This keyword should not be used
67 in combination with recov.
68
69
70 print Print the message to the standard error
71 stream stderr.
72
73
74 console Write the message to the system console.
75 print, console, or both may be used.
76
77
78
79 -l label Identifies the source of the message.
80
81
82 -s severity Indicates the seriousness of the error. The keywords
83 and definitions of the standard levels of severity are:
84
85 halt The application has encountered a severe fault
86 and is halting.
87
88
89 error The application has detected a fault.
90
91
92 warn The application has detected a condition that
93 is out of the ordinary and might be a problem.
94
95
96 info The application is providing information about
97 a condition that is not in error.
98
99
100
101 -t tag The string containing an identifier for the message.
102
103
104 -a action A text string describing the first step in the error
105 recovery process. This string must be written so that
106 the entire action argument is interpreted as a single
107 argument. fmtmsg precedes each action string with the
108 TO FIX: prefix.
109
110
111 text A text string describing the condition. Must be written
112 so that the entire text argument is interpreted as a
113 single argument.
114
115
117 Example 1 Standard message format
118
119
120 The following example of fmtmsg produces a complete message in the
121 standard message format and displays it to the standard error stream.
122
123
124 example% fmtmsg -c soft -u recov,print,appl -l UX:cat \
125 -s error -t UX:cat:001 -a "refer to manual" "invalid syntax"
126
127
128
129
130 produces:
131
132
133 UX:cat: ERROR: invalid syntax
134 TO FIX: refer to manual UX:cat:138
135
136
137
138 Example 2 Using MSGVERB
139
140
141 When the environment variable MSGVERB is set as follows:
142
143
144 MSGVERB=severity:text:action
145
146
147
148
149 and Example 1 is used, fmtmsg produces:
150
151
152 ERROR: invalid syntax
153 TO FIX: refer to manual
154
155
156
157 Example 3 Using SEV_LEVEL
158
159
160 When the environment variable SEV_LEVEL is set as follows:
161
162
163 SEV_LEVEL=note,5,NOTE
164
165
166
167
168 the following fmtmsg command:
169
170
171 example% fmtmsg -c soft -u print -l UX:cat -s note \
172 -a "refer to manual" "invalid syntax"
173
174
175
176
177 produces:
178
179
180 NOTE: invalid syntax
181 TO FIX: refer to manual
182
183
184
185
186 and displays the message on stderr.
187
188
190 The environment variables MSGVERB and SEV_LEVEL control the behavior of
191 fmtmsg. MSGVERB is set by the administrator in the /etc/profile for the
192 system. Users can override the value of MSGVERB set by the system by
193 resetting MSGVERB in their own .profile files or by changing the value
194 in their current shell session. SEV_LEVEL can be used in shell scripts.
195
196
197 MSGVERB tells fmtmsg which message components to select when writing
198 messages to stderr. The value of MSGVERB is a colon-separated list of
199 optional keywords. MSGVERB can be set as follows:
200
201 MSGVERB=[keyword[:keyword[:...]]]
202 export MSGVERB
203
204
205
206
207 Valid keywords are: label, severity, text, action, and tag. If MSGVERB
208 contains a keyword for a component and the component's value is not the
209 component's null value, fmtmsg includes that component in the message
210 when writing the message to stderr. If MSGVERB does not include a key‐
211 word for a message component, that component is not included in the
212 display of the message. The keywords may appear in any order. If
213 MSGVERB is not defined, if its value is the null string, if its value
214 is not of the correct format, or if it contains keywords other than the
215 valid ones listed above, fmtmsg selects all components.
216
217
218 MSGVERB affects only which message components are selected for display.
219 All message components are included in console messages.
220
221
222 SEV_LEVEL defines severity levels and associates print strings with
223 them for use by fmtmsg. The standard severity levels shown below cannot
224 be modified. Additional severity levels can be defined, redefined, and
225 removed.
226
227 0 (no severity is used)
228
229
230 1 HALT
231
232
233 2 ERROR
234
235
236 3 WARNING
237
238
239 4 INFO
240
241
242
243 SEV_LEVEL is set as follows:
244
245
246 description is a comma-separated list containing three fields:
247
248 SEV_LEVEL= [description[:description[:...]]]
249 export SEV_LEVEL
250
251
252
253
254 description=severity_keyword, level, printstring
255
256
257 severity_keyword is a character string used as the keyword with the -s
258 severity option to fmtmsg.
259
260
261 level is a character string that evaluates to a positive integer (other
262 than 0, 1, 2, 3, or 4, which are reserved for the standard severity
263 levels). If the keyword severity_keyword is used, level is the severity
264 value passed on to fmtmsg(3C).
265
266
267 printstring is the character string used by fmtmsg in the standard mes‐
268 sage format whenever the severity value level is used.
269
270
271 If SEV_LEVEL is not defined, or if its value is null, no severity lev‐
272 els other than the defaults are available. If a description in the
273 colon separated list is not a comma separated list containing three
274 fields, or if the second field of a comma separated list does not eval‐
275 uate to a positive integer, that description in the colon separated
276 list is ignored.
277
279 The following exit values are returned:
280
281 0 All the requested functions were executed successfully.
282
283
284 1 The command contains a syntax error, an invalid option, or an
285 invalid argument to an option.
286
287
288 2 The function executed with partial success, however the message
289 was not displayed on stderr.
290
291
292 4 The function executed with partial success; however, the message
293 was not displayed on the system console.
294
295
296 32 No requested functions were executed successfully.
297
298
300 See attributes(5) for descriptions of the following attributes:
301
302
303
304
305 ┌─────────────────────────────┬─────────────────────────────┐
306 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
307 ├─────────────────────────────┼─────────────────────────────┤
308 │Availability │SUNWcsu │
309 └─────────────────────────────┴─────────────────────────────┘
310
312 addseverity(3C), fmtmsg(3C), attributes(5)
313
314
315
316SunOS 5.11 20 Jul 1994 fmtmsg(1)