1 .\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
3 .\" adapted glibc info page
5 .\" This should run as 'Guru Meditation' (amiga joke :)
6 .\" The function is quite complex and deserves an example
8 .\" Polished, aeb, 2003-11-01
10 .\" Japanese Version Copyright (c) 2004 Yuichi SATO
11 .\" all rights reserved.
12 .\" Translated Sat Jul 24 20:19:54 JST 2004
13 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
15 .TH FMTMSG 3 2008-06-14 "" "Linux Programmer's Manual"
18 .\"O fmtmsg \- print formatted error messages
19 fmtmsg \- 整形されたエラーメッセージを表示する
23 .B #include <fmtmsg.h>
25 .BI "int fmtmsg(long " classification ", const char *" label ,
27 .BI " int " severity ", const char *" text ,
29 .BI " const char *" action ", const char *" tag );
33 .\"O This function displays a message described by its arguments on the device(s)
35 .\"O .I classification
37 .\"O For messages written to
39 .\"O the format depends on the
41 .\"O environment variable.
42 この関数は、引き数で記述されたメッセージを、
52 .\"O argument identifies the source of the message.
53 .\"O The string must consist
54 .\"O of two colon separated parts where the first part has not more
55 .\"O than 10 and the second part not more than 14 characters.
58 この文字列はコロンで区切られた 2 つの部分から構成されていなければならない。
59 1 つ目の部分は 10 文字以内でなければならず、
60 2 つ目の部分は 14 文字以内でなければならない。
64 .\"O argument describes the condition of the error.
70 .\"O argument describes possible steps to recover from the error.
71 .\"O If it is printed, it is prefixed by "TO FIX: ".
73 引き数にはエラーから回復するために利用可能なステップを記述する。
74 これが表示される場合、"TO FIX: " が前に付く。
78 .\"O argument is a reference to the online documentation where more
79 .\"O information can be found.
80 .\"O It should contain the
82 .\"O value and a unique identification number.
84 引き数はより多くの情報を見つけるためのオンラインドキュメントへの参照である。
87 値とユニークな識別番号を含んでいるべきである。
88 .\"O .SS "Dummy arguments"
90 .\"O Each of the arguments can have a dummy value.
91 .\"O The dummy classification value
93 .\"O (0L) does not specify any output, so nothing is printed.
94 各引き数にはダミーの値を入れることができる。
99 (0L) は出力を何も指定しない。そのため何も表示されない。
100 .\"O The dummy severity value
102 .\"O (0) says that no severity is supplied.
107 (0) は重大度 (severity) が与えられていないことを表す。
109 .\"O .BR MM_NULLLBL ,
110 .\"O .BR MM_NULLTXT ,
111 .\"O .BR MM_NULLACT ,
113 .\"O are synonyms for
114 .\"O .IR "((char *) 0)" ,
115 .\"O the empty string, and
117 .\"O is a synonym for
131 .\"O .SS "The classification argument"
132 .SS "classification 引き数"
134 .\"O .I classification
135 .\"O argument is the sum of values describing 4 types of information.
137 引き数は 4 種類の情報を記述する値の和である。
140 .\"O The first value defines the output channel.
150 .\"O Output to the system console.
153 .B "MM_PRINT | MM_CONSOLE"
157 .\"O The second value is the source of the error:
161 .\"O A hardware error occurred.
165 .\"O A firmware error occurred.
169 .\"O A software error occurred.
172 .\"O The third value encodes the detector of the problem:
173 3 番目の値は問題の検知を行ったものをエンコードする:
176 .\"O It is detected by an application.
180 .\"O It is detected by a utility.
184 .\"O It is detected by the operating system.
185 オペレーティングシステムによって検知された。
187 .\"O The fourth value shows the severity of the incident:
191 .\"O It is a recoverable error.
195 .\"O It is a nonrecoverable error.
197 .\"O .SS "The severity argument"
201 .\"O argument can take one of the following values:
203 引き数は以下の 1 つの値をとることができる。
206 .\"O No severity is printed.
210 .\"O This value is printed as HALT.
214 .\"O This value is printed as ERROR.
218 .\"O This value is printed as WARNING.
219 この値は WARNING として表示される。
222 .\"O This value is printed as INFO.
225 .\"O The numeric values are between 0 and 4.
227 .\"O .BR addseverity (3)
228 .\"O or the environment variable
230 .\"O you can add more levels and strings to print.
235 を使うことにより、表示するレベルと文字列を更に追加できる。
236 .\"O .SH "RETURN VALUE"
238 .\"O The function can return 4 values:
242 .\"O Everything went smooth.
246 .\"O Complete failure.
250 .\"O Error writing to
256 .\"O Error writing to the console.
257 コンソールに書き込むときにエラーが起こった。
260 .\"O The environment variable
262 .\"O ("message verbosity") can be used to suppress parts of
267 ("message verbosity") は
269 への出力の一部を抑制するのに使うことができる。
270 .\"O (It does not influence output to the console.)
272 .\"O When this variable is defined, is non-NULL, and is a colon-separated
273 .\"O list of valid keywords, then only the parts of the message corresponding
274 .\"O to these keywords is printed.
276 コロンで区切られた有効なキーワードのリストである場合、
277 キーワードに対応するメッセージの一部のみが表示される。
278 .\"O Valid keywords are "label", "severity", "text", "action" and "tag".
279 有効なキーワードは "label", "severity", "text", "action", "tag" である。
281 .\"O The environment variable
283 .\"O can be used to introduce new severity levels.
286 は新しい重大度レベルを導入するのに使用できる。
287 .\"O By default, only the five severity levels described
288 .\"O above are available.
289 .\"O Any other numeric value would make
292 デフォルトでは、上記の 5 つの重大度レベルのみが利用可能である。
296 .\"O If the user puts
298 .\"O with a format like
301 .\"O SEV_LEVEL=[description[:description[:...]]]
304 .\"O in the environment of the process before the first call to
306 .\"O where each description is of the form
309 .\"O severity-keyword,level,printstring
314 .\"O will also accept the indicated values for the level (in addition to
315 .\"O the standard levels 0-4), and use the indicated printstring when
316 .\"O such a level occurs.
323 SEV_LEVEL=[description[:description[:...]]]
326 のような形式でプロセスの環境に設定すると、
328 は (標準のレベル 0-4 に加えて) level に指定された値も受け付け、
329 そのようなレベルの問題が発生すると指定された printstring を表示する。
333 severity-keyword,level,printstring
338 .\"O The severity-keyword part is not used by
340 .\"O but it has to be present.
343 に使用されないが、存在しなければならない。
344 .\"O The level part is a string representation of a number.
345 level 部は数値を文字列で表したものである。
346 .\"O The numeric value must be a number greater than 4.
347 数値は 4 より大きい値でなければならない。
348 .\"O This value must be used in the severity argument of
350 .\"O to select this class.
351 .\"O It is not possible to overwrite
352 .\"O any of the predefined classes.
354 .\"O is the string printed when a message of this class is processed by
358 の severity 引き数で使用されなければならず、この重大度を選択する。
359 前もって宣言された重大度を上書きすることはできない。
363 によって生成された場合に表示される文字列である。
367 .\"O is provided in glibc since version 2.1.
369 は、バージョン 2.1 以降の glibc で提供されている。
370 .\"O .SH "CONFORMING TO"
375 .\"O .BR addseverity (3),
376 .\"O and environment variables
380 .\"O come from System V.
392 .\"O and the environment variable
394 .\"O are described in POSIX.1-2001.
399 は POSIX.1-2001 に記述されている。
402 .\"O System V and UnixWare man pages tell us that these functions
403 .\"O have been replaced by "pfmt() and addsev()" or by "pfmt(),
404 .\"O vpfmt(), lfmt(), and vlfmt()", and will be removed later.
405 System V と UnixWare の man ページには、
406 「これらの関数は "pfmt() と addsev()"
407 または "pfmt(), vpfmt(), lfmt(), vlfmt()" で置き換えられており、
408 将来は削除される予定である」と書かれている。
419 long class = MM_PRINT | MM_SOFT | MM_OPSYS | MM_RECOVER;
422 err = fmtmsg(class, "util\-linux:mount", MM_ERROR,
423 "unknown mount option", "See mount(8).",
424 "util\-linux:mount:017");
429 printf("Nothing printed\en");
432 printf("Nothing printed to stderr\en");
435 printf("No console output\en");
438 printf("Unknown error from fmtmsg()\en");
444 .\"O The output should be:
448 util\-linux:mount: ERROR: unknown mount option
449 TO FIX: See mount(8). util\-linux:mount:017
456 MSGVERB=text:action; export MSGVERB
459 .\"O the output becomes:
464 TO FIX: See mount(8).