xref: /csrg-svn/usr.bin/error/error.1 (revision 61987)
1*61987Sbostic.\" Copyright (c) 1980, 1990, 1993
2*61987Sbostic.\"	The Regents of the University of California.  All rights reserved.
319122Smckusick.\"
450522Scael.\" %sccs.include.redist.roff%
519122Smckusick.\"
6*61987Sbostic.\"	@(#)error.1	8.1 (Berkeley) 06/06/93
735860Sbostic.\"
843688Scael.Dd
943688Scael.Dt ERROR 1
1043688Scael.Os BSD 4
1143688Scael.Sh NAME
1243688Scael.Nm error
1343688Scael.Nd analyze and disperse compiler error messages
1443688Scael.Sh SYNOPSIS
1543688Scael.Nm error
1643688Scael.Op Fl n
1743688Scael.Op Fl s
1843688Scael.Op Fl q
1943688Scael.Op Fl v
2043688Scael.Op Fl t Ar suffixlist
2143688Scael.Op Fl I Ar ignorefile
2243688Scael.Op name
2343688Scael.Sh DESCRIPTION
2443688Scael.Nm Error
2519122Smckusickanalyzes and optionally disperses the diagnostic error messages
2619122Smckusickproduced by a number of compilers and language processors to the source
2719122Smckusickfile and line where the errors occurred.  It can replace the painful,
2819122Smckusicktraditional methods of scribbling abbreviations of errors on paper, and
2919122Smckusickpermits error messages and source code to be viewed simultaneously
3019122Smckusickwithout machinations of multiple windows in a screen editor.
3143688Scael.Pp
3243688ScaelOptions are:
3350522Scael.Bl -tag -width Ds
3450522Scael.It Fl n
3543688ScaelDo
3643688Scael.Em not
3743688Scaeltouch any files; all error messages are sent to the
3843688Scaelstandard output.
3950522Scael.It Fl q
4043688ScaelThe user is
4143688Scael.Ar queried
4243688Scaelwhether s/he wants to touch the file.
4343688ScaelA ``y'' or ``n'' to the question is necessary to continue.
4443688ScaelAbsence of the
4543688Scael.Fl q
4643688Scaeloption implies that all referenced files
4743688Scael(except those referring to discarded error messages)
4843688Scaelare to be touched.
4950522Scael.It Fl v
5043688ScaelAfter all files have been touched,
5143688Scaeloverlay the visual editor
5250522Scael.Xr \&vi 1
5343688Scaelwith it set up to edit all files touched,
5443688Scaeland positioned in the first touched file at the first error.
5543688ScaelIf
5650522Scael.Xr \&vi 1
5743688Scaelcan't be found, try
5850522Scael.Xr \&ex 1
5943688Scaelor
6050522Scael.Xr \&ed 1
6143688Scaelfrom standard places.
6250522Scael.It Fl t
6343688ScaelTake the following argument as a suffix list.
6443688ScaelFiles whose suffixes do not appear in the suffix list are not touched.
6543688ScaelThe suffix list is dot separated, and ``*'' wildcards work.
6643688ScaelThus the suffix list:
6743688Scael.Pp
6843688Scael.Dl ".c.y.foo*.h"
6943688Scael.Pp
7043688Scaelallows
7143688Scael.Nm error
7243688Scaelto touch files ending with ``.c'', ``.y'', ``.foo*'' and ``.y''.
7350522Scael.It Fl s
7443688ScaelPrint out
7543688Scael.Em statistics
7643688Scaelregarding the error categorization.
7743688ScaelNot too useful.
7850522Scael.El
7943688Scael.Pp
8043688Scael.Nm Error
8119122Smckusicklooks at the error messages,
8243688Scaeleither from the specified file
8343688Scael.Ar name
8419122Smckusickor from the standard input,
8519122Smckusickand attempts to determine which
8619122Smckusicklanguage processor produced each error message,
8719122Smckusickdetermines the source file and line number to which the error message refers,
8819122Smckusickdetermines if the error message is to be ignored or not,
8919122Smckusickand inserts the (possibly slightly modified) error message into
9019123Smckusickthe source file as a comment on the line preceding to which the
9119122Smckusickline the error message refers.
9219122SmckusickError messages which can't be categorized by language processor
9319122Smckusickor content are not inserted into any file,
9419122Smckusickbut are sent to the standard output.
9543688Scael.Nm Error
9619122Smckusicktouches source files only after all input has been read.
9743688Scael.Pp
9843688Scael.Nm Error
9919122Smckusickis intended to be run
10019122Smckusickwith its standard input
10119122Smckusickconnected via a pipe to the error message source.
10219122SmckusickSome language processors put error messages on their standard error file;
10319122Smckusickothers put their messages on the standard output.
10419122SmckusickHence, both error sources should be piped together into
10543688Scael.Nm error .
10643688ScaelFor example, when using the
10743688Scael.Xr csh 1
10843688Scaelsyntax,
10943688Scael.Pp
11044953Scael.Dl make \-s lint \&| error \-q \-v
11143688Scael.Pp
11219122Smckusickwill analyze all the error messages produced
11319122Smckusickby whatever programs
11443688Scael.Xr make 1
11519122Smckusickruns when making lint.
11643688Scael.Pp
11743688Scael.Nm Error
11819122Smckusickknows about the error messages produced by:
11943688Scael.Xr make 1 ,
12050522Scael.Xr \&cc 1 ,
12143688Scael.Xr cpp 1 ,
12243688Scael.Xr ccom 1 ,
12350522Scael.Xr \&as 1 ,
12450522Scael.Xr \&ld 1 ,
12543688Scael.Xr lint 1 ,
12650522Scael.Xr \&pi 1 ,
12750522Scael.Xr \&pc 1 ,
12843688Scael.Xr f77 1 ,
12919122Smckusickand
13043688Scael.Em DEC Western Research Modula\-2 .
13143688Scael.Nm Error
13219122Smckusickknows a standard format for error messages produced by
13319122Smckusickthe language processors,
13419122Smckusickso is sensitive to changes in these formats.
13543688ScaelFor all languages except
13643688Scael.Em Pascal ,
13719122Smckusickerror messages are restricted to be on one line.
13819122SmckusickSome error messages refer to more than one line in more than
13919122Smckusickone files;
14043688Scael.Nm error
14119122Smckusickwill duplicate the error message and insert it at
14219122Smckusickall of the places referenced.
14343688Scael.Pp
14443688Scael.Nm Error
14519122Smckusickwill do one of six things with error messages.
14650522Scael.Bl -tag -width Em synchronize
14750522Scael.It Em synchronize
14819122SmckusickSome language processors produce short errors describing
14919122Smckusickwhich file it is processing.
15043688Scael.Nm Error
15119122Smckusickuses these to determine the file name for languages that
15219122Smckusickdon't include the file name in each error message.
15319122SmckusickThese synchronization messages are consumed entirely by
15443688Scael.Nm error .
15550522Scael.It Em discard
15619122SmckusickError messages from
15743688Scael.Xr lint 1
15819122Smckusickthat refer to one of the two
15943688Scael.Xr lint 1
16019122Smckusicklibraries,
16143688Scael.Pa /usr/libdata/lint/llib-lc
16219122Smckusickand
16343688Scael.Pa /usr/libdata/lint/llib-port
16419122Smckusickare discarded,
16519122Smckusickto prevent accidently touching these libraries.
16619122SmckusickAgain, these error messages are consumed entirely by
16743688Scael.Nm error .
16850522Scael.It Em nullify
16919122SmckusickError messages from
17043688Scael.Xr lint 1
17119122Smckusickcan be nullified if they refer to a specific function,
17219122Smckusickwhich is known to generate diagnostics which are not interesting.
17319122SmckusickNullified error messages are not inserted into the source file,
17419122Smckusickbut are written to the standard output.
17519122SmckusickThe names of functions to ignore are taken from
17619122Smckusickeither the file named
17743688Scael.Pa .errorrc
17843688Scaelin the users's home directory,
17919122Smckusickor from the file named by the
18043688Scael.Fl I
18119122Smckusickoption.
18219122SmckusickIf the file does not exist,
18319122Smckusickno error messages are nullified.
18419122SmckusickIf the file does exist, there must be one function
18519122Smckusickname per line.
18650522Scael.It Em not file specific
18719122SmckusickError messages that can't be intuited are grouped together,
18819122Smckusickand written to the standard output before any files are touched.
18919122SmckusickThey will not be inserted into any source file.
19050522Scael.It Em file specific
19119122SmckusickError message that refer to a specific file,
19219122Smckusickbut to no specific line,
19319122Smckusickare written to the standard output when
19419122Smckusickthat file is touched.
19550522Scael.It Em true errors
19619122SmckusickError messages that can be intuited are candidates for
19719122Smckusickinsertion into the file to which they refer.
19850522Scael.El
19943688Scael.Pp
20019122SmckusickOnly true error messages are candidates for inserting into
20119122Smckusickthe file they refer to.
20219122SmckusickOther error messages are consumed entirely by
20343688Scael.Nm error
20419122Smckusickor are written to the standard output.
20543688Scael.Nm Error
20619122Smckusickinserts the error messages into the source file on the line
20719123Smckusickpreceding the line the language processor found in error.
20819122SmckusickEach error message is turned into a one line comment for the
20919122Smckusicklanguage,
21019122Smckusickand is internally flagged
21119122Smckusickwith the string ``###'' at
21219122Smckusickthe beginning of the error,
21319122Smckusickand ``%%%'' at the end of the error.
21419122SmckusickThis makes pattern searching for errors easier with an editor,
21519122Smckusickand allows the messages to be easily removed.
21619122SmckusickIn addition, each error message contains the source line number
21719122Smckusickfor the line the message refers to.
21819122SmckusickA reasonably formatted source program can be recompiled
21919122Smckusickwith the error messages still in it,
22019122Smckusickwithout having the error messages themselves cause future errors.
22119122SmckusickFor poorly formatted source programs in free format languages,
22219122Smckusicksuch as C or Pascal,
22319122Smckusickit is possible to insert a comment into another comment,
22419122Smckusickwhich can wreak havoc with a future compilation.
22519123SmckusickTo avoid this, programs with comments and source
22619123Smckusickon the same line should be formatted
22719123Smckusickso that language statements appear before comments.
22843688Scael.Pp
22943688Scael.Nm Error
23019122Smckusickcatches interrupt and terminate signals,
23119122Smckusickand if in the insertion phase,
23219122Smckusickwill orderly terminate what it is doing.
23343688Scael.Sh FILES
23450522Scael.Bl -tag -width ~/.errorrc -compact
23550522Scael.It Pa ~/.errorrc
23643688Scaelfunction names to ignore for
23743688Scael.Xr lint 1
23843688Scaelerror messages
23950522Scael.It Pa /dev/tty
24043688Scaeluser's teletype
24150522Scael.El
24243688Scael.Sh HISTORY
24350522ScaelThe
24450522Scael.Nm error
24550522Scaelcommand
24650522Scaelappeared in
24750522Scael.Bx 4.0 .
24843688Scael.Sh AUTHOR
24919122SmckusickRobert Henry
25043688Scael.Sh BUGS
25143688Scael.Pp
25219122SmckusickOpens the teletype directly to do user querying.
25343688Scael.Pp
25419122SmckusickSource files with links make a new copy of the file with
25519122Smckusickonly one link to it.
25643688Scael.Pp
25719122SmckusickChanging a language processor's format of error messages
25843688Scaelmay cause
25943688Scael.Nm error
26019122Smckusickto not understand the error message.
26143688Scael.Pp
26243688Scael.Nm Error ,
26319122Smckusicksince it is purely mechanical,
26419122Smckusickwill not filter out subsequent errors caused by `floodgating'
26519122Smckusickinitiated by one syntactically trivial error.
26619122SmckusickHumans are still much better at discarding these related errors.
26743688Scael.Pp
26819122SmckusickPascal error messages belong after the lines affected
26943688Scael(error puts them before).  The alignment of the `\\' marking
27019122Smckusickthe point of error is also disturbed by
27143688Scael.Nm error .
27243688Scael.Pp
27343688Scael.Nm Error
27450522Scaelwas designed for work on
27550522Scael.Tn CRT Ns 's
27650522Scaelat reasonably high speed.
27719122SmckusickIt is less pleasant on slow speed terminals, and has never been
27819122Smckusickused on hardcopy terminals.
279