3 .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 .if !
\a\\$4
\a\a .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
7 .ie
\a\\$3
\a\a .ft \\$1
11 .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
16 .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
19 .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
22 .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
24 .de EX \" start example
41 error \- error and debug trace message formatter
46 Error_info_t error_info;
48 void error(int \fIlevel\fP, ...);
49 void errorv(const char* \fIlibrary\fP, int \fIlevel\fP, va_alist \fIargs\fP);
50 void liberror(const char* \fIlibrary\fP, int \fIlevel\fP, ...);
54 debug(\fIstatement\fP)
55 message((int \fIlevel\fP, ...))
56 libmessage((const char* \fIlibrary\fI, int \fIlevel\fP, ...))
60 is the error and debug trace message formatter.
62 is the severity level.
64 .I "level < error_info.trace"
69 The remaining arguments are passed on to
73 is appended to the message text, so none should appear in the
85 Before the message text is output to standard error
86 it is passed to the function
87 .LR "char* ERROR_translate(const char* \fItext\fP, int \fIflag\fP)" .
92 argument, but on some systems it may do language translation via lookup
93 on the original source text.
105 Negative values are for debug tracing.
106 Debug messages are prefixed with
109 .I "errno != error_info.last_errno"
111 .I error_info.last_errno
114 and the error text for errno is appended to the message.
117 Information only; no prefixes are added to the message.
119 .B "ERROR_WARNING [1]"
124 .I error_info.warnings
132 .B ">= ERROR_FATAL [3]"
136 .L exit(\fIlevel\fP\-2)
137 is called after the message is emitted.
139 .B "ERROR_PANIC [77]"
140 (unrecoverable internal error)
145 The following may be inclusive-or'd into
147 for alternate behavior:
152 is appended to the message.
155 The next argument is the file descriptor where the error message
159 Then next two arguments are a file name and line number that are added
164 A usage message is emitted.
174 prefix is suppressed.
177 The message is from a library routine.
179 The elements of the global struct
181 control error output and actions.
184 can be initialized from the
186 environment variable.
188 contains space separated
190 options, described below.
194 .I "error_info.core != 0"
196 .I "level >= error_info.core"
197 generates a core dump.
200 ERROR_OPTIONS="core=\fIlevel\fP"
204 can be a number or one of
210 is a handy way to get a stack trace at the exact point of error.
212 .I "int error_info.trace"
214 .I "error_info.trace != 0"
216 .I "level < error_info.trace"
217 then the error message text is suppressed.
219 may still be called if appropriate for
223 ERROR_OPTIONS="trace=\fIlevel\fP"
227 is set to the negative of
230 Library error messages, suppressed by default, are enabled by
232 ERROR_OPTIONS="library"
236 message text can be forced for each message by
238 ERROR_OPTIONS="system"
240 .SH "EXTENDED DESCRIPTION"
242 provides debugging message macros when
254 All of the macros expand to nothing when both
270 .IR "error_info.trace<0" .
275 are macro hacks that require double parentheses ((...)) around the
278 To enable debugging message level -3, library messages, and system
280 text for all commands:
282 export ERROR_OPTIONS="trace=3 library system"