cleanups, add manual page
[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.\"
bb6b9ca5 5.\" @(#)error.1 6.2 (Berkeley) %G%
ea733718 6.\"
b4a596d3 7.TH ERROR 1 ""
ea733718
KM
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
62f70816 46the source file as a comment on the line preceding to which the
ea733718
KM
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,
bb6b9ca5
KM
101.I pc,
102.I f77,
ea733718 103and
bb6b9ca5 104.I DEC Western Research Modula-2.
ea733718
KM
105.I Error
106knows a standard format for error messages produced by
107the language processors,
108so is sensitive to changes in these formats.
109For all languages except
110.I Pascal,
111error messages are restricted to be on one line.
112Some error messages refer to more than one line in more than
113one files;
114.I error
115will duplicate the error message and insert it at
116all of the places referenced.
117.PP
118.I Error
119will do one of six things with error messages.
120.TP 10
121.I synchronize
122Some language processors produce short errors describing
123which file it is processing.
124.I Error
125uses these to determine the file name for languages that
126don't include the file name in each error message.
127These synchronization messages are consumed entirely by
128.I error.
129.TP 10
130.I discard
131Error messages from
132.I lint
133that refer to one of the two
134.I lint
135libraries,
136.I /usr/lib/llib-lc
137and
138.I /usr/lib/llib-port
139are discarded,
140to prevent accidently touching these libraries.
141Again, these error messages are consumed entirely by
142.I error.
143.TP 10
144.I nullify
145Error messages from
146.I lint
147can be nullified if they refer to a specific function,
148which is known to generate diagnostics which are not interesting.
149Nullified error messages are not inserted into the source file,
150but are written to the standard output.
151The names of functions to ignore are taken from
152either the file named
153.I .errorrc
154in the users's home directory,
155or from the file named by the
156.B \-I
157option.
158If the file does not exist,
159no error messages are nullified.
160If the file does exist, there must be one function
161name per line.
162.TP 10
163.I not file specific
164Error messages that can't be intuited are grouped together,
165and written to the standard output before any files are touched.
166They will not be inserted into any source file.
167.TP 10
168.I file specific
169Error message that refer to a specific file,
170but to no specific line,
171are written to the standard output when
172that file is touched.
173.TP 10
174.I true errors
175Error messages that can be intuited are candidates for
176insertion into the file to which they refer.
177.PP
178Only true error messages are candidates for inserting into
179the file they refer to.
180Other error messages are consumed entirely by
181.I error
182or are written to the standard output.
183.I Error
184inserts the error messages into the source file on the line
62f70816 185preceding the line the language processor found in error.
ea733718
KM
186Each error message is turned into a one line comment for the
187language,
188and is internally flagged
189with the string ``###'' at
190the beginning of the error,
191and ``%%%'' at the end of the error.
192This makes pattern searching for errors easier with an editor,
193and allows the messages to be easily removed.
194In addition, each error message contains the source line number
195for the line the message refers to.
196A reasonably formatted source program can be recompiled
197with the error messages still in it,
198without having the error messages themselves cause future errors.
199For poorly formatted source programs in free format languages,
200such as C or Pascal,
201it is possible to insert a comment into another comment,
202which can wreak havoc with a future compilation.
62f70816
KM
203To avoid this, programs with comments and source
204on the same line should be formatted
205so that language statements appear before comments.
ea733718
KM
206.PP
207Options available with
208.I error
209are:
210.TP 5
211.B \-n
212Do
213.I not
214touch any files; all error messages are sent to the
215standard output.
216.TP 5
217.B \-q
218The user is
219.I queried
220whether s/he wants to touch the file.
221A ``y'' or ``n'' to the question is necessary to continue.
222Absence of the
223.B \-q
224option implies that all referenced files
62f70816 225(except those referring to discarded error messages)
ea733718
KM
226are to be touched.
227.TP 5
228.B \-v
229After all files have been touched,
230overlay the visual editor
231.I vi
232with it set up to edit all files touched,
233and positioned in the first touched file at the first error.
234If
235.I vi
236can't be found, try
237.I ex
238or
239.I ed
240from standard places.
241.TP 5
242.B \-t
243Take the following argument as a suffix list.
62f70816
KM
244Files whose suffixes do not appear in the suffix list are not touched.
245The suffix list is dot separated, and ``*'' wildcards work.
ea733718
KM
246Thus the suffix list:
247.IP
248\& ".c.y.foo*.h"
249.IP
250allows
251.I error
252to touch files ending with ``.c'', ``.y'', ``.foo*'' and ``.y''.
253.TP 5
254.B \-s
255Print out
256.I statistics
257regarding the error categorization.
258Not too useful.
259.PP
260.I Error
261catches interrupt and terminate signals,
262and if in the insertion phase,
263will orderly terminate what it is doing.
264.SH AUTHOR
265Robert Henry
266.SH FILES
267.ta 2i
268~/.errorrc function names to ignore for \fIlint\fP error messages
269.br
270/dev/tty user's teletype
271.SH BUGS
272.PP
273Opens the teletype directly to do user querying.
274.PP
275Source files with links make a new copy of the file with
276only one link to it.
277.PP
278Changing a language processor's format of error messages
279may cause
280.I error
281to not understand the error message.
282.PP
283.I Error,
284since it is purely mechanical,
285will not filter out subsequent errors caused by `floodgating'
286initiated by one syntactically trivial error.
287Humans are still much better at discarding these related errors.
288.PP
289Pascal error messages belong after the lines affected
290(error puts them before). The alignment of the `\||\|' marking
291the point of error is also disturbed by
292.I error.
293.PP
294.I Error
295was designed for work on CRT's at reasonably high speed.
296It is less pleasant on slow speed terminals, and has never been
297used on hardcopy terminals.