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