1*43688Scael.\" Copyright (c) 1980, 1990 The Regents of the University of California. 235860Sbostic.\" All rights reserved. 319122Smckusick.\" 4*43688Scael.\" %sccs.include.redist.man% 519122Smckusick.\" 6*43688Scael.\" @(#)error.1 6.4 (Berkeley) 06/24/90 735860Sbostic.\" 8*43688Scael.Dd 9*43688Scael.Dt ERROR 1 10*43688Scael.Os BSD 4 11*43688Scael.Sh NAME 12*43688Scael.Nm error 13*43688Scael.Nd analyze and disperse compiler error messages 14*43688Scael.Sh SYNOPSIS 15*43688Scael.Nm error 16*43688Scael.Op Fl n 17*43688Scael.Op Fl s 18*43688Scael.Op Fl q 19*43688Scael.Op Fl v 20*43688Scael.Op Fl t Ar suffixlist 21*43688Scael.Op Fl I Ar ignorefile 22*43688Scael.Op name 23*43688Scael.Sh DESCRIPTION 24*43688Scael.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. 31*43688Scael.Pp 32*43688ScaelOptions are: 33*43688Scael.Tp Fl n 34*43688ScaelDo 35*43688Scael.Em not 36*43688Scaeltouch any files; all error messages are sent to the 37*43688Scaelstandard output. 38*43688Scael.Tp Fl q 39*43688ScaelThe user is 40*43688Scael.Ar queried 41*43688Scaelwhether s/he wants to touch the file. 42*43688ScaelA ``y'' or ``n'' to the question is necessary to continue. 43*43688ScaelAbsence of the 44*43688Scael.Fl q 45*43688Scaeloption implies that all referenced files 46*43688Scael(except those referring to discarded error messages) 47*43688Scaelare to be touched. 48*43688Scael.Tp Fl v 49*43688ScaelAfter all files have been touched, 50*43688Scaeloverlay the visual editor 51*43688Scael.Xr vi 52*43688Scaelwith it set up to edit all files touched, 53*43688Scaeland positioned in the first touched file at the first error. 54*43688ScaelIf 55*43688Scael.Xr vi 56*43688Scaelcan't be found, try 57*43688Scael.Xr ex 58*43688Scaelor 59*43688Scael.Xr ed 60*43688Scaelfrom standard places. 61*43688Scael.Tp Fl t 62*43688ScaelTake the following argument as a suffix list. 63*43688ScaelFiles whose suffixes do not appear in the suffix list are not touched. 64*43688ScaelThe suffix list is dot separated, and ``*'' wildcards work. 65*43688ScaelThus the suffix list: 66*43688Scael.Pp 67*43688Scael.Dl ".c.y.foo*.h" 68*43688Scael.Pp 69*43688Scaelallows 70*43688Scael.Nm error 71*43688Scaelto touch files ending with ``.c'', ``.y'', ``.foo*'' and ``.y''. 72*43688Scael.Tp Fl s 73*43688ScaelPrint out 74*43688Scael.Em statistics 75*43688Scaelregarding the error categorization. 76*43688ScaelNot too useful. 77*43688Scael.Tp 78*43688Scael.Pp 79*43688Scael.Nm Error 8019122Smckusicklooks at the error messages, 81*43688Scaeleither from the specified file 82*43688Scael.Ar name 8319122Smckusickor from the standard input, 8419122Smckusickand attempts to determine which 8519122Smckusicklanguage processor produced each error message, 8619122Smckusickdetermines the source file and line number to which the error message refers, 8719122Smckusickdetermines if the error message is to be ignored or not, 8819122Smckusickand inserts the (possibly slightly modified) error message into 8919123Smckusickthe source file as a comment on the line preceding to which the 9019122Smckusickline the error message refers. 9119122SmckusickError messages which can't be categorized by language processor 9219122Smckusickor content are not inserted into any file, 9319122Smckusickbut are sent to the standard output. 94*43688Scael.Nm Error 9519122Smckusicktouches source files only after all input has been read. 96*43688Scael.Pp 97*43688Scael.Nm Error 9819122Smckusickis intended to be run 9919122Smckusickwith its standard input 10019122Smckusickconnected via a pipe to the error message source. 10119122SmckusickSome language processors put error messages on their standard error file; 10219122Smckusickothers put their messages on the standard output. 10319122SmckusickHence, both error sources should be piped together into 104*43688Scael.Nm error . 105*43688ScaelFor example, when using the 106*43688Scael.Xr csh 1 107*43688Scaelsyntax, 108*43688Scael.Pp 109*43688Scael.Dl make \-s lint \& error \-q \-v 110*43688Scael.Pp 11119122Smckusickwill analyze all the error messages produced 11219122Smckusickby whatever programs 113*43688Scael.Xr make 1 11419122Smckusickruns when making lint. 115*43688Scael.Pp 116*43688Scael.Nm Error 11719122Smckusickknows about the error messages produced by: 118*43688Scael.Xr make 1 , 119*43688Scael.Xr cc 1 , 120*43688Scael.Xr cpp 1 , 121*43688Scael.Xr ccom 1 , 122*43688Scael.Xr as 1 , 123*43688Scael.Xr ld 1 , 124*43688Scael.Xr lint 1 , 125*43688Scael.Xr pi 1 , 126*43688Scael.Xr pc 1 , 127*43688Scael.Xr f77 1 , 12819122Smckusickand 129*43688Scael.Em DEC Western Research Modula\-2 . 130*43688Scael.Nm Error 13119122Smckusickknows a standard format for error messages produced by 13219122Smckusickthe language processors, 13319122Smckusickso is sensitive to changes in these formats. 134*43688ScaelFor all languages except 135*43688Scael.Em Pascal , 13619122Smckusickerror messages are restricted to be on one line. 13719122SmckusickSome error messages refer to more than one line in more than 13819122Smckusickone files; 139*43688Scael.Nm error 14019122Smckusickwill duplicate the error message and insert it at 14119122Smckusickall of the places referenced. 142*43688Scael.Pp 143*43688Scael.Nm Error 14419122Smckusickwill do one of six things with error messages. 145*43688Scael.Tp Em synchronize 14619122SmckusickSome language processors produce short errors describing 14719122Smckusickwhich file it is processing. 148*43688Scael.Nm Error 14919122Smckusickuses these to determine the file name for languages that 15019122Smckusickdon't include the file name in each error message. 15119122SmckusickThese synchronization messages are consumed entirely by 152*43688Scael.Nm error . 153*43688Scael.Tp Em discard 15419122SmckusickError messages from 155*43688Scael.Xr lint 1 15619122Smckusickthat refer to one of the two 157*43688Scael.Xr lint 1 15819122Smckusicklibraries, 159*43688Scael.Pa /usr/libdata/lint/llib-lc 16019122Smckusickand 161*43688Scael.Pa /usr/libdata/lint/llib-port 16219122Smckusickare discarded, 16319122Smckusickto prevent accidently touching these libraries. 16419122SmckusickAgain, these error messages are consumed entirely by 165*43688Scael.Nm error . 166*43688Scael.Tp Em nullify 16719122SmckusickError messages from 168*43688Scael.Xr lint 1 16919122Smckusickcan be nullified if they refer to a specific function, 17019122Smckusickwhich is known to generate diagnostics which are not interesting. 17119122SmckusickNullified error messages are not inserted into the source file, 17219122Smckusickbut are written to the standard output. 17319122SmckusickThe names of functions to ignore are taken from 17419122Smckusickeither the file named 175*43688Scael.Pa .errorrc 176*43688Scaelin the users's home directory, 17719122Smckusickor from the file named by the 178*43688Scael.Fl I 17919122Smckusickoption. 18019122SmckusickIf the file does not exist, 18119122Smckusickno error messages are nullified. 18219122SmckusickIf the file does exist, there must be one function 18319122Smckusickname per line. 184*43688Scael.Tp Em not file specific 18519122SmckusickError messages that can't be intuited are grouped together, 18619122Smckusickand written to the standard output before any files are touched. 18719122SmckusickThey will not be inserted into any source file. 188*43688Scael.Tp Em file specific 18919122SmckusickError message that refer to a specific file, 19019122Smckusickbut to no specific line, 19119122Smckusickare written to the standard output when 19219122Smckusickthat file is touched. 193*43688Scael.Tp Em true errors 19419122SmckusickError messages that can be intuited are candidates for 19519122Smckusickinsertion into the file to which they refer. 196*43688Scael.Tp 197*43688Scael.Pp 19819122SmckusickOnly true error messages are candidates for inserting into 19919122Smckusickthe file they refer to. 20019122SmckusickOther error messages are consumed entirely by 201*43688Scael.Nm error 20219122Smckusickor are written to the standard output. 203*43688Scael.Nm Error 20419122Smckusickinserts the error messages into the source file on the line 20519123Smckusickpreceding the line the language processor found in error. 20619122SmckusickEach error message is turned into a one line comment for the 20719122Smckusicklanguage, 20819122Smckusickand is internally flagged 20919122Smckusickwith the string ``###'' at 21019122Smckusickthe beginning of the error, 21119122Smckusickand ``%%%'' at the end of the error. 21219122SmckusickThis makes pattern searching for errors easier with an editor, 21319122Smckusickand allows the messages to be easily removed. 21419122SmckusickIn addition, each error message contains the source line number 21519122Smckusickfor the line the message refers to. 21619122SmckusickA reasonably formatted source program can be recompiled 21719122Smckusickwith the error messages still in it, 21819122Smckusickwithout having the error messages themselves cause future errors. 21919122SmckusickFor poorly formatted source programs in free format languages, 22019122Smckusicksuch as C or Pascal, 22119122Smckusickit is possible to insert a comment into another comment, 22219122Smckusickwhich can wreak havoc with a future compilation. 22319123SmckusickTo avoid this, programs with comments and source 22419123Smckusickon the same line should be formatted 22519123Smckusickso that language statements appear before comments. 226*43688Scael.Pp 227*43688Scael.Nm Error 22819122Smckusickcatches interrupt and terminate signals, 22919122Smckusickand if in the insertion phase, 23019122Smckusickwill orderly terminate what it is doing. 231*43688Scael.Sh FILES 232*43688Scael.Dw ~/.errorrc 233*43688Scael.Di L 234*43688Scael.Dp ~/.errorrc 235*43688Scaelfunction names to ignore for 236*43688Scael.Xr lint 1 237*43688Scaelerror messages 238*43688Scael.Dp Pa /dev/tty 239*43688Scaeluser's teletype 240*43688Scael.Dp 241*43688Scael.Sh HISTORY 242*43688Scael.Nm Error 243*43688Scaelappeared in 4.0 BSD. 244*43688Scael.Sh AUTHOR 24519122SmckusickRobert Henry 246*43688Scael.Sh BUGS 247*43688Scael.Pp 24819122SmckusickOpens the teletype directly to do user querying. 249*43688Scael.Pp 25019122SmckusickSource files with links make a new copy of the file with 25119122Smckusickonly one link to it. 252*43688Scael.Pp 25319122SmckusickChanging a language processor's format of error messages 254*43688Scaelmay cause 255*43688Scael.Nm error 25619122Smckusickto not understand the error message. 257*43688Scael.Pp 258*43688Scael.Nm Error , 25919122Smckusicksince it is purely mechanical, 26019122Smckusickwill not filter out subsequent errors caused by `floodgating' 26119122Smckusickinitiated by one syntactically trivial error. 26219122SmckusickHumans are still much better at discarding these related errors. 263*43688Scael.Pp 26419122SmckusickPascal error messages belong after the lines affected 265*43688Scael(error puts them before). The alignment of the `\\' marking 26619122Smckusickthe point of error is also disturbed by 267*43688Scael.Nm error . 268*43688Scael.Pp 269*43688Scael.Nm Error 27019122Smckusickwas designed for work on CRT's at reasonably high speed. 27119122SmckusickIt is less pleasant on slow speed terminals, and has never been 27219122Smckusickused on hardcopy terminals. 273