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