manual page distributed with 4.1BSD
[unix-history] / usr / src / usr.bin / error / error.1
CommitLineData
ea733718
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\" @(#)error.1 4.1 (Berkeley) %G%
6.\"
7.TH ERROR 1
8.UC 4
9.SH NAME
10error \- analyze and disperse compiler error messages
11.SH SYNOPSIS
12.B error
13[
14.B \-n
15] [
16.B \-s
17] [
18.B \-q
19] [
20.B \-v
21] [
22.B \-t
23suffixlist
24] [
25.B \-I
26ignorefile
27] [ name ]
28.SH DESCRIPTION
29.I Error
30analyzes and optionally disperses the diagnostic error messages
31produced by a number of compilers and language processors to the source
32file and line where the errors occurred. It can replace the painful,
33traditional methods of scribbling abbreviations of errors on paper, and
34permits error messages and source code to be viewed simultaneously
35without machinations of multiple windows in a screen editor.
36.PP
37.I Error
38looks at the error messages,
39either from the specified file \fIname\fR
40or from the standard input,
41and attempts to determine which
42language processor produced each error message,
43determines the source file and line number to which the error message refers,
44determines if the error message is to be ignored or not,
45and inserts the (possibly slightly modified) error message into
46the source file as a comment on the line preceeding to which the
47line the error message refers.
48Error messages which can't be categorized by language processor
49or content are not inserted into any file,
50but are sent to the standard output.
51.I Error
52touches source files only after all input has been read.
53By specifying the
54.B \-q
55query option,
56the user is asked to confirm any potentially
57dangerous (such as touching a file) or verbose action.
58Otherwise
59.I error
60proceeds on its merry business.
61If the
62.B \-t
63touch option and associated suffix list is given,
64.I error
65will restrict itself to touch only those files with suffices
66in the suffix list.
67Error also can be asked (by specifying
68.B \-v)
69to invoke
70.IR vi (1)
71on the files in which error messages were inserted; this obviates
72the need to remember the names of the files with errors.
73.PP
74.I Error
75is intended to be run
76with its standard input
77connected via a pipe to the error message source.
78Some language processors put error messages on their standard error file;
79others put their messages on the standard output.
80Hence, both error sources should be piped together into
81.I error.
82For example, when using the \fIcsh\fP syntax,
83.IP
84make \-s lint |\|& error \-q \-v
85.LP
86will analyze all the error messages produced
87by whatever programs
88.I make
89runs when making lint.
90.PP
91.I Error
92knows about the error messages produced by:
93.I make,
94.I cc,
95.I cpp,
96.I ccom,
97.I as,
98.I ld,
99.I lint,
100.I pi,
101.I pc
102and
103.I f77.
104.I Error
105knows a standard format for error messages produced by
106the language processors,
107so is sensitive to changes in these formats.
108For all languages except
109.I Pascal,
110error messages are restricted to be on one line.
111Some error messages refer to more than one line in more than
112one files;
113.I error
114will duplicate the error message and insert it at
115all of the places referenced.
116.PP
117.I Error
118will do one of six things with error messages.
119.TP 10
120.I synchronize
121Some language processors produce short errors describing
122which file it is processing.
123.I Error
124uses these to determine the file name for languages that
125don't include the file name in each error message.
126These synchronization messages are consumed entirely by
127.I error.
128.TP 10
129.I discard
130Error messages from
131.I lint
132that refer to one of the two
133.I lint
134libraries,
135.I /usr/lib/llib-lc
136and
137.I /usr/lib/llib-port
138are discarded,
139to prevent accidently touching these libraries.
140Again, these error messages are consumed entirely by
141.I error.
142.TP 10
143.I nullify
144Error messages from
145.I lint
146can be nullified if they refer to a specific function,
147which is known to generate diagnostics which are not interesting.
148Nullified error messages are not inserted into the source file,
149but are written to the standard output.
150The names of functions to ignore are taken from
151either the file named
152.I .errorrc
153in the users's home directory,
154or from the file named by the
155.B \-I
156option.
157If the file does not exist,
158no error messages are nullified.
159If the file does exist, there must be one function
160name per line.
161.TP 10
162.I not file specific
163Error messages that can't be intuited are grouped together,
164and written to the standard output before any files are touched.
165They will not be inserted into any source file.
166.TP 10
167.I file specific
168Error message that refer to a specific file,
169but to no specific line,
170are written to the standard output when
171that file is touched.
172.TP 10
173.I true errors
174Error messages that can be intuited are candidates for
175insertion into the file to which they refer.
176.PP
177Only true error messages are candidates for inserting into
178the file they refer to.
179Other error messages are consumed entirely by
180.I error
181or are written to the standard output.
182.I Error
183inserts the error messages into the source file on the line
184preceeding the line the language processor found in error.
185Each error message is turned into a one line comment for the
186language,
187and is internally flagged
188with the string ``###'' at
189the beginning of the error,
190and ``%%%'' at the end of the error.
191This makes pattern searching for errors easier with an editor,
192and allows the messages to be easily removed.
193In addition, each error message contains the source line number
194for the line the message refers to.
195A reasonably formatted source program can be recompiled
196with the error messages still in it,
197without having the error messages themselves cause future errors.
198For poorly formatted source programs in free format languages,
199such as C or Pascal,
200it is possible to insert a comment into another comment,
201which can wreak havoc with a future compilation.
202To avoid this, format the source program so there are no
203language statements on the same line as the end of a comment.
204.PP
205Options available with
206.I error
207are:
208.TP 5
209.B \-n
210Do
211.I not
212touch any files; all error messages are sent to the
213standard output.
214.TP 5
215.B \-q
216The user is
217.I queried
218whether s/he wants to touch the file.
219A ``y'' or ``n'' to the question is necessary to continue.
220Absence of the
221.B \-q
222option implies that all referenced files
223(except those refering to discarded error messages)
224are to be touched.
225.TP 5
226.B \-v
227After all files have been touched,
228overlay the visual editor
229.I vi
230with it set up to edit all files touched,
231and positioned in the first touched file at the first error.
232If
233.I vi
234can't be found, try
235.I ex
236or
237.I ed
238from standard places.
239.TP 5
240.B \-t
241Take the following argument as a suffix list.
242Files whose suffices do not appear in the suffix list are not touched.
243The suffix list is dot seperated, and ``*'' wildcards work.
244Thus the suffix list:
245.IP
246\& ".c.y.foo*.h"
247.IP
248allows
249.I error
250to touch files ending with ``.c'', ``.y'', ``.foo*'' and ``.y''.
251.TP 5
252.B \-s
253Print out
254.I statistics
255regarding the error categorization.
256Not too useful.
257.PP
258.I Error
259catches interrupt and terminate signals,
260and if in the insertion phase,
261will orderly terminate what it is doing.
262.SH AUTHOR
263Robert Henry
264.SH FILES
265.ta 2i
266~/.errorrc function names to ignore for \fIlint\fP error messages
267.br
268/dev/tty user's teletype
269.SH BUGS
270.PP
271Opens the teletype directly to do user querying.
272.PP
273Source files with links make a new copy of the file with
274only one link to it.
275.PP
276Changing a language processor's format of error messages
277may cause
278.I error
279to not understand the error message.
280.PP
281.I Error,
282since it is purely mechanical,
283will not filter out subsequent errors caused by `floodgating'
284initiated by one syntactically trivial error.
285Humans are still much better at discarding these related errors.
286.PP
287Pascal error messages belong after the lines affected
288(error puts them before). The alignment of the `\||\|' marking
289the point of error is also disturbed by
290.I error.
291.PP
292.I Error
293was designed for work on CRT's at reasonably high speed.
294It is less pleasant on slow speed terminals, and has never been
295used on hardcopy terminals.