143688Scael.\" Copyright (c) 1980, 1990 The Regents of the University of California. 235860Sbostic.\" All rights reserved. 319122Smckusick.\" 443688Scael.\" %sccs.include.redist.man% 519122Smckusick.\" 6*44953Scael.\" @(#)error.1 6.5 (Berkeley) 07/24/90 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: 33*44953Scael.Tw Ds 3443688Scael.Tp Fl n 3543688ScaelDo 3643688Scael.Em not 3743688Scaeltouch any files; all error messages are sent to the 3843688Scaelstandard output. 3943688Scael.Tp 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. 4943688Scael.Tp Fl v 5043688ScaelAfter all files have been touched, 5143688Scaeloverlay the visual editor 52*44953Scael.Xr vi 1 5343688Scaelwith it set up to edit all files touched, 5443688Scaeland positioned in the first touched file at the first error. 5543688ScaelIf 56*44953Scael.Xr vi 1 5743688Scaelcan't be found, try 58*44953Scael.Xr ex 1 5943688Scaelor 60*44953Scael.Xr ed 1 6143688Scaelfrom standard places. 6243688Scael.Tp 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''. 7343688Scael.Tp Fl s 7443688ScaelPrint out 7543688Scael.Em statistics 7643688Scaelregarding the error categorization. 7743688ScaelNot too useful. 7843688Scael.Tp 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 110*44953Scael.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 , 12043688Scael.Xr cc 1 , 12143688Scael.Xr cpp 1 , 12243688Scael.Xr ccom 1 , 12343688Scael.Xr as 1 , 12443688Scael.Xr ld 1 , 12543688Scael.Xr lint 1 , 12643688Scael.Xr pi 1 , 12743688Scael.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. 14643688Scael.Tp Em synchronize 14719122SmckusickSome language processors produce short errors describing 14819122Smckusickwhich file it is processing. 14943688Scael.Nm Error 15019122Smckusickuses these to determine the file name for languages that 15119122Smckusickdon't include the file name in each error message. 15219122SmckusickThese synchronization messages are consumed entirely by 15343688Scael.Nm error . 15443688Scael.Tp Em discard 15519122SmckusickError messages from 15643688Scael.Xr lint 1 15719122Smckusickthat refer to one of the two 15843688Scael.Xr lint 1 15919122Smckusicklibraries, 16043688Scael.Pa /usr/libdata/lint/llib-lc 16119122Smckusickand 16243688Scael.Pa /usr/libdata/lint/llib-port 16319122Smckusickare discarded, 16419122Smckusickto prevent accidently touching these libraries. 16519122SmckusickAgain, these error messages are consumed entirely by 16643688Scael.Nm error . 16743688Scael.Tp Em nullify 16819122SmckusickError messages from 16943688Scael.Xr lint 1 17019122Smckusickcan be nullified if they refer to a specific function, 17119122Smckusickwhich is known to generate diagnostics which are not interesting. 17219122SmckusickNullified error messages are not inserted into the source file, 17319122Smckusickbut are written to the standard output. 17419122SmckusickThe names of functions to ignore are taken from 17519122Smckusickeither the file named 17643688Scael.Pa .errorrc 17743688Scaelin the users's home directory, 17819122Smckusickor from the file named by the 17943688Scael.Fl I 18019122Smckusickoption. 18119122SmckusickIf the file does not exist, 18219122Smckusickno error messages are nullified. 18319122SmckusickIf the file does exist, there must be one function 18419122Smckusickname per line. 18543688Scael.Tp Em not file specific 18619122SmckusickError messages that can't be intuited are grouped together, 18719122Smckusickand written to the standard output before any files are touched. 18819122SmckusickThey will not be inserted into any source file. 18943688Scael.Tp Em file specific 19019122SmckusickError message that refer to a specific file, 19119122Smckusickbut to no specific line, 19219122Smckusickare written to the standard output when 19319122Smckusickthat file is touched. 19443688Scael.Tp Em true errors 19519122SmckusickError messages that can be intuited are candidates for 19619122Smckusickinsertion into the file to which they refer. 19743688Scael.Tp 19843688Scael.Pp 19919122SmckusickOnly true error messages are candidates for inserting into 20019122Smckusickthe file they refer to. 20119122SmckusickOther error messages are consumed entirely by 20243688Scael.Nm error 20319122Smckusickor are written to the standard output. 20443688Scael.Nm Error 20519122Smckusickinserts the error messages into the source file on the line 20619123Smckusickpreceding the line the language processor found in error. 20719122SmckusickEach error message is turned into a one line comment for the 20819122Smckusicklanguage, 20919122Smckusickand is internally flagged 21019122Smckusickwith the string ``###'' at 21119122Smckusickthe beginning of the error, 21219122Smckusickand ``%%%'' at the end of the error. 21319122SmckusickThis makes pattern searching for errors easier with an editor, 21419122Smckusickand allows the messages to be easily removed. 21519122SmckusickIn addition, each error message contains the source line number 21619122Smckusickfor the line the message refers to. 21719122SmckusickA reasonably formatted source program can be recompiled 21819122Smckusickwith the error messages still in it, 21919122Smckusickwithout having the error messages themselves cause future errors. 22019122SmckusickFor poorly formatted source programs in free format languages, 22119122Smckusicksuch as C or Pascal, 22219122Smckusickit is possible to insert a comment into another comment, 22319122Smckusickwhich can wreak havoc with a future compilation. 22419123SmckusickTo avoid this, programs with comments and source 22519123Smckusickon the same line should be formatted 22619123Smckusickso that language statements appear before comments. 22743688Scael.Pp 22843688Scael.Nm Error 22919122Smckusickcatches interrupt and terminate signals, 23019122Smckusickand if in the insertion phase, 23119122Smckusickwill orderly terminate what it is doing. 23243688Scael.Sh FILES 23343688Scael.Dw ~/.errorrc 23443688Scael.Di L 235*44953Scael.Dp Pa ~/.errorrc 23643688Scaelfunction names to ignore for 23743688Scael.Xr lint 1 23843688Scaelerror messages 23943688Scael.Dp Pa /dev/tty 24043688Scaeluser's teletype 24143688Scael.Dp 24243688Scael.Sh HISTORY 24343688Scael.Nm Error 24443688Scaelappeared in 4.0 BSD. 24543688Scael.Sh AUTHOR 24619122SmckusickRobert Henry 24743688Scael.Sh BUGS 24843688Scael.Pp 24919122SmckusickOpens the teletype directly to do user querying. 25043688Scael.Pp 25119122SmckusickSource files with links make a new copy of the file with 25219122Smckusickonly one link to it. 25343688Scael.Pp 25419122SmckusickChanging a language processor's format of error messages 25543688Scaelmay cause 25643688Scael.Nm error 25719122Smckusickto not understand the error message. 25843688Scael.Pp 25943688Scael.Nm Error , 26019122Smckusicksince it is purely mechanical, 26119122Smckusickwill not filter out subsequent errors caused by `floodgating' 26219122Smckusickinitiated by one syntactically trivial error. 26319122SmckusickHumans are still much better at discarding these related errors. 26443688Scael.Pp 26519122SmckusickPascal error messages belong after the lines affected 26643688Scael(error puts them before). The alignment of the `\\' marking 26719122Smckusickthe point of error is also disturbed by 26843688Scael.Nm error . 26943688Scael.Pp 27043688Scael.Nm Error 27119122Smckusickwas designed for work on CRT's at reasonably high speed. 27219122SmckusickIt is less pleasant on slow speed terminals, and has never been 27319122Smckusickused on hardcopy terminals. 274