FIXES revision 90902
185587Sobrien/**************************************************************** 285587SobrienCopyright (C) Lucent Technologies 1997 385587SobrienAll Rights Reserved 485587Sobrien 585587SobrienPermission to use, copy, modify, and distribute this software and 685587Sobrienits documentation for any purpose and without fee is hereby 785587Sobriengranted, provided that the above copyright notice appear in all 885587Sobriencopies and that both that the copyright notice and this 985587Sobrienpermission notice and warranty disclaimer appear in supporting 1085587Sobriendocumentation, and that the name Lucent Technologies or any of 1185587Sobrienits entities not be used in advertising or publicity pertaining 1285587Sobriento distribution of the software without specific, written prior 1385587Sobrienpermission. 1485587Sobrien 1585587SobrienLUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 1685587SobrienINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. 1785587SobrienIN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY 1885587SobrienSPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1985587SobrienWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 2085587SobrienIN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 2185587SobrienARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 2285587SobrienTHIS SOFTWARE. 2385587Sobrien****************************************************************/ 2485587Sobrien 2585587SobrienThis file lists all bug fixes, changes, etc., made since the AWK book 2685587Sobrienwas sent to the printers in August, 1987. 2785587Sobrien 2890902SdesFeb 10, 2002: 2990902Sdes changed types in posix chars structure to quiet solaris cc. 3090902Sdes 3190902SdesJan 1, 2002: 3290902Sdes fflush() or fflush("") flushes all files and pipes. 3390902Sdes 3490902Sdes length(arrayname) returns number of elements; thanks to 3590902Sdes arnold robbins for suggestion. 3690902Sdes 3790902Sdes added a makefile.win to make it easier to build on windows. 3890902Sdes based on dan allen's buildwin.bat. 3990902Sdes 4090902SdesNov 16, 2001: 4190902Sdes added support for posix character class names like [:digit:], 4290902Sdes which are not exactly shorter than [0-9] and perhaps no more 4390902Sdes portable. thanks to dag-erling smorgrav for code. 4490902Sdes 4590902SdesFeb 16, 2001: 4690902Sdes removed -m option; no longer needed, and it was actually 4790902Sdes broken (noted thanks to volker kiefel). 4890902Sdes 4990902SdesFeb 10, 2001: 5090902Sdes fixed an appalling bug in gettok: any sequence of digits, +,-, E, e, 5190902Sdes and period was accepted as a valid number if it started with a period. 5290902Sdes this would never have happened with the lex version. 5390902Sdes 5490902Sdes other 1-character botches, now fixed, include a bare $ and a 5590902Sdes bare " at the end of the input. 5690902Sdes 5790902SdesFeb 7, 2001: 5890902Sdes more (const char *) casts in b.c and tran.c to silence warnings. 5990902Sdes 6085587SobrienNov 15, 2000: 6185587Sobrien fixed a bug introduced in august 1997 that caused expressions 6285587Sobrien like $f[1] to be syntax errors. thanks to arnold robbins for 6385587Sobrien noticing this and providing a fix. 6485587Sobrien 6585587SobrienOct 30, 2000: 6685587Sobrien fixed some nextfile bugs: not handling all cases. thanks to 6785587Sobrien arnold robbins for pointing this out. new regressions added. 6885587Sobrien 6985587Sobrien close() is now a function. it returns whatever the library 7085587Sobrien fclose returns, and -1 for closing a file or pipe that wasn't 7185587Sobrien opened. 7285587Sobrien 7385587SobrienSep 24, 2000: 7485587Sobrien permit \n explicitly in character classes; won't work right 7585587Sobrien if comes in as "[\n]" but ok as /[\n]/, because of multiple 7685587Sobrien processing of \'s. thanks to arnold robbins. 7785587Sobrien 7885587SobrienJuly 5, 2000: 7985587Sobrien minor fiddles in tran.c to keep compilers happy about uschar. 8085587Sobrien thanks to norman wilson. 8185587Sobrien 8285587SobrienMay 25, 2000: 8385587Sobrien yet another attempt at making 8-bit input work, with another 8485587Sobrien band-aid in b.c (member()), and some (uschar) casts to head 8585587Sobrien off potential errors in subscripts (like isdigit). also 8685587Sobrien changed HAT to NCHARS-2. thanks again to santiago vila. 8785587Sobrien 8885587Sobrien changed maketab.c to ignore apparently out of range definitions 8985587Sobrien instead of halting; new freeBSD generates one. thanks to 9085587Sobrien jon snader <jsnader@ix.netcom.com> for pointing out the problem. 9185587Sobrien 9285587SobrienMay 2, 2000: 9385587Sobrien fixed an 8-bit problem in b.c by making several char*'s into 9485587Sobrien unsigned char*'s. not clear i have them all yet. thanks to 9585587Sobrien Santiago Vila <sanvila@unex.es> for the bug report. 9685587Sobrien 9785587SobrienApr 21, 2000: 9885587Sobrien finally found and fixed a memory leak in function call; it's 9985587Sobrien been there since functions were added ~1983. thanks to 10085587Sobrien jon bentley for the test case that found it. 10185587Sobrien 10285587Sobrien added test in envinit to catch environment "variables" with 10385587Sobrien names begining with '='; thanks to Berend Hasselman. 10485587Sobrien 10585587SobrienJul 28, 1999: 10685587Sobrien added test in defn() to catch function foo(foo), which 10785587Sobrien otherwise recurses until core dump. thanks to arnold 10885587Sobrien robbins for noticing this. 10985587Sobrien 11085587SobrienJun 20, 1999: 11185587Sobrien added *bp in gettok in lex.c; appears possible to exit function 11285587Sobrien without terminating the string. thanks to russ cox. 11385587Sobrien 11485587SobrienJun 2, 1999: 11585587Sobrien added function stdinit() to run to initialize files[] array, 11685587Sobrien in case stdin, etc., are not constants; some compilers care. 11785587Sobrien 11885587SobrienMay 10, 1999: 11985587Sobrien replaced the ERROR ... FATAL, etc., macros with functions 12085587Sobrien based on vprintf, to avoid problems caused by overrunning 12185587Sobrien fixed-size errbuf array. thanks to ralph corderoy for the 12285587Sobrien impetus, and for pointing out a string termination bug in 12385587Sobrien qstring as well. 12485587Sobrien 12585587SobrienApr 21, 1999: 12685587Sobrien fixed bug that caused occasional core dumps with commandline 12785587Sobrien variable with value ending in \. (thanks to nelson beebe for 12885587Sobrien the test case.) 12985587Sobrien 13085587SobrienApr 16, 1999: 13185587Sobrien with code kindly provided by Bruce Lilly, awk now parses 13285587Sobrien /=/ and similar constructs more sensibly in more places. 13385587Sobrien Bruce also provided some helpful test cases. 13485587Sobrien 13585587SobrienApr 5, 1999: 13685587Sobrien changed true/false to True/False in run.c to make it 13785587Sobrien easier to compile with C++. Added some casts on malloc 13885587Sobrien and realloc to be honest about casts; ditto. changed 13985587Sobrien ltype int to long in struct rrow to reduce some 64-bit 14085587Sobrien complaints; other changes scattered throughout for the 14185587Sobrien same purpose. thanks to Nelson Beebe for these portability 14285587Sobrien improvements. 14385587Sobrien 14485587Sobrien removed some horrible pointer-int casting in b.c and elsewhere 14585587Sobrien by adding ptoi and itonp to localize the casts, which are 14685587Sobrien all benign. fixed one incipient bug that showed up on sgi 14785587Sobrien in 64-bit mode. 14885587Sobrien 14985587Sobrien reset lineno for new source file; include filename in error 15085587Sobrien message. also fixed line number error in continuation lines. 15185587Sobrien (thanks to Nelson Beebe for both of these.) 15285587Sobrien 15385587SobrienMar 24, 1999: 15485587Sobrien Nelson Beebe notes that irix 5.3 yacc dies with a bogus 15585587Sobrien error; use a newer version or switch to bison, since sgi 15685587Sobrien is unlikely to fix it. 15785587Sobrien 15885587SobrienMar 5, 1999: 15985587Sobrien changed isnumber to is_number to avoid the problem caused by 16085587Sobrien versions of ctype.h that include the name isnumber. 16185587Sobrien 16285587Sobrien distribution now includes a script for building on a Mac, 16385587Sobrien thanks to Dan Allen. 16485587Sobrien 16585587SobrienFeb 20, 1999: 16685587Sobrien fixed memory leaks in run.c (call) and tran.c (setfval). 16785587Sobrien thanks to Stephen Nutt for finding these and providing the fixes. 16885587Sobrien 16985587SobrienJan 13, 1999: 17085587Sobrien replaced srand argument by (unsigned int) in run.c; 17185587Sobrien avoids problem on Mac and potentially on Unix & Windows. 17285587Sobrien thanks to Dan Allen. 17385587Sobrien 17485587Sobrien added a few (int) casts to silence useless compiler warnings. 17585587Sobrien e.g., errorflag= in run.c jump(). 17685587Sobrien 17785587Sobrien added proctab.c to the bundle outout; one less thing 17885587Sobrien to have to compile out of the box. 17985587Sobrien 18085587Sobrien added calls to _popen and _pclose to the win95 stub for 18185587Sobrien pipes (thanks to Steve Adams for this helpful suggestion). 18285587Sobrien seems to work, though properties are not well understood 18385587Sobrien by me, and it appears that under some circumstances the 18485587Sobrien pipe output is truncated. Be careful. 18585587Sobrien 18685587SobrienOct 19, 1998: 18785587Sobrien fixed a couple of bugs in getrec: could fail to update $0 18885587Sobrien after a getline var; because inputFS wasn't initialized, 18985587Sobrien could split $0 on every character, a misleading diversion. 19085587Sobrien 19185587Sobrien fixed caching bug in makedfa: LRU was actually removing 19285587Sobrien least often used. 19385587Sobrien 19485587Sobrien thanks to ross ridge for finding these, and for providing 19585587Sobrien great bug reports. 19685587Sobrien 19785587SobrienMay 12, 1998: 19885587Sobrien fixed potential bug in readrec: might fail to update record 19985587Sobrien pointer after growing. thanks to dan levy for spotting this 20085587Sobrien and suggesting the fix. 20185587Sobrien 20285587SobrienMar 12, 1998: 20385587Sobrien added -V to print version number and die. 20485587Sobrien 20585587SobrienFeb 11, 1998: 20685587Sobrien subtle silent bug in lex.c: if the program ended with a number 20785587Sobrien longer than 1 digit, part of the input would be pushed back and 20885587Sobrien parsed again because token buffer wasn't terminated right. 20985587Sobrien example: awk 'length($0) > 10'. blush. at least i found it 21085587Sobrien myself. 21185587Sobrien 21285587SobrienAug 31, 1997: 21385587Sobrien s/adelete/awkdelete/: SGI uses this in malloc.h. 21485587Sobrien thanks to nelson beebe for pointing this one out. 21585587Sobrien 21685587SobrienAug 21, 1997: 21785587Sobrien fixed some bugs in sub and gsub when replacement includes \\. 21885587Sobrien this is a dark, horrible corner, but at least now i believe that 21985587Sobrien the behavior is the same as gawk and the intended posix standard. 22085587Sobrien thanks to arnold robbins for advice here. 22185587Sobrien 22285587SobrienAug 9, 1997: 22385587Sobrien somewhat regretfully, replaced the ancient lex-based lexical 22485587Sobrien analyzer with one written in C. it's longer, generates less code, 22585587Sobrien and more portable; the old one depended too much on mysterious 22685587Sobrien properties of lex that were not preserved in other environments. 22785587Sobrien in theory these recognize the same language. 22885587Sobrien 22985587Sobrien now using strtod to test whether a string is a number, instead of 23085587Sobrien the convoluted original function. should be more portable and 23185587Sobrien reliable if strtod is implemented right. 23285587Sobrien 23385587Sobrien removed now-pointless optimization in makefile that tries to avoid 23485587Sobrien recompilation when awkgram.y is changed but symbols are not. 23585587Sobrien 23685587Sobrien removed most fixed-size arrays, though a handful remain, some 23785587Sobrien of which are unchecked. you have been warned. 23885587Sobrien 23985587SobrienAug 4, 1997: 24085587Sobrien with some trepidation, replaced the ancient code that managed 24185587Sobrien fields and $0 in fixed-size arrays with arrays that grow on 24285587Sobrien demand. there is still some tension between trying to make this 24385587Sobrien run fast and making it clean; not sure it's right yet. 24485587Sobrien 24585587Sobrien the ill-conceived -mr and -mf arguments are now useful only 24685587Sobrien for debugging. previous dynamic string code removed. 24785587Sobrien 24885587Sobrien numerous other minor cleanups along the way. 24985587Sobrien 25085587SobrienJul 30, 1997: 25185587Sobrien using code provided by dan levy (to whom profuse thanks), replaced 25285587Sobrien fixed-size arrays and awkward kludges by a fairly uniform mechanism 25385587Sobrien to grow arrays as needed for printf, sub, gsub, etc. 25485587Sobrien 25585587SobrienJul 23, 1997: 25685587Sobrien falling off the end of a function returns "" and 0, not 0. 25785587Sobrien thanks to arnold robbins. 25885587Sobrien 25985587SobrienJun 17, 1997: 26085587Sobrien replaced several fixed-size arrays by dynamically-created ones 26185587Sobrien in run.c; added overflow tests to some previously unchecked cases. 26285587Sobrien getline, toupper, tolower. 26385587Sobrien 26485587Sobrien getline code is still broken in that recursive calls may wind 26585587Sobrien up using the same space. [fixed later] 26685587Sobrien 26785587Sobrien increased RECSIZE to 8192 to push problems further over the horizon. 26885587Sobrien 26985587Sobrien added \r to \n as input line separator for programs, not data. 27085587Sobrien damn CRLFs. 27185587Sobrien 27285587Sobrien modified format() to permit explicit printf("%c", 0) to include 27385587Sobrien a null byte in output. thanks to ken stailey for the fix. 27485587Sobrien 27585587Sobrien added a "-safe" argument that disables file output (print >, 27685587Sobrien print >>), process creation (cmd|getline, print |, system), and 27785587Sobrien access to the environment (ENVIRON). this is a first approximation 27885587Sobrien to a "safe" version of awk, but don't rely on it too much. thanks 27985587Sobrien to joan feigenbaum and matt blaze for the inspiration long ago. 28085587Sobrien 28185587SobrienJul 8, 1996: 28285587Sobrien fixed long-standing bug in sub, gsub(/a/, "\\\\&"); thanks to 28385587Sobrien ralph corderoy. 28485587Sobrien 28585587SobrienJun 29, 1996: 28685587Sobrien fixed awful bug in new field splitting; didn't get all the places 28785587Sobrien where input was done. 28885587Sobrien 28985587SobrienJun 28, 1996: 29085587Sobrien changed field-splitting to conform to posix definition: fields are 29185587Sobrien split using the value of FS at the time of input; it used to be 29285587Sobrien the value when the field or NF was first referred to, a much less 29385587Sobrien predictable definition. thanks to arnold robbins for encouragement 29485587Sobrien to do the right thing. 29585587Sobrien 29685587SobrienMay 28, 1996: 29785587Sobrien fixed appalling but apparently unimportant bug in parsing octal 29885587Sobrien numbers in reg exprs. 29985587Sobrien 30085587Sobrien explicit hex in reg exprs now limited to 2 chars: \xa, \xaa. 30185587Sobrien 30285587SobrienMay 27, 1996: 30385587Sobrien cleaned up some declarations so gcc -Wall is now almost silent. 30485587Sobrien 30585587Sobrien makefile now includes backup copies of ytab.c and lexyy.c in case 30685587Sobrien one makes before looking; it also avoids recreating lexyy.c unless 30785587Sobrien really needed. 30885587Sobrien 30985587Sobrien s/aprintf/awkprint, s/asprintf/awksprintf/ to avoid some name clashes 31085587Sobrien with unwisely-written header files. 31185587Sobrien 31285587Sobrien thanks to jeffrey friedl for several of these. 31385587Sobrien 31485587SobrienMay 26, 1996: 31585587Sobrien an attempt to rationalize the (unsigned) char issue. almost all 31685587Sobrien instances of unsigned char have been removed; the handful of places 31785587Sobrien in b.c where chars are used as table indices have been hand-crafted. 31885587Sobrien added some latin-1 tests to the regression, but i'm not confident; 31985587Sobrien none of my compilers seem to care much. thanks to nelson beebe for 32085587Sobrien pointing out some others that do care. 32185587Sobrien 32285587SobrienMay 2, 1996: 32385587Sobrien removed all register declarations. 32485587Sobrien 32585587Sobrien enhanced split(), as in gawk, etc: split(s, a, "") splits s into 32685587Sobrien a[1]...a[length(s)] with each character a single element. 32785587Sobrien 32885587Sobrien made the same changes for field-splitting if FS is "". 32985587Sobrien 33085587Sobrien added nextfile, as in gawk: causes immediate advance to next 33185587Sobrien input file. (thanks to arnold robbins for inspiration and code). 33285587Sobrien 33385587Sobrien small fixes to regexpr code: can now handle []], [[], and 33485587Sobrien variants; [] is now a syntax error, rather than matching 33585587Sobrien everything; [z-a] is now empty, not z. far from complete 33685587Sobrien or correct, however. (thanks to jeffrey friedl for pointing out 33785587Sobrien some awful behaviors.) 33885587Sobrien 33985587SobrienApr 29, 1996: 34085587Sobrien replaced uchar by uschar everwhere; apparently some compilers 34185587Sobrien usurp this name and this causes conflicts. 34285587Sobrien 34385587Sobrien fixed call to time in run.c (bltin); arg is time_t *. 34485587Sobrien 34585587Sobrien replaced horrible pointer/long punning in b.c by a legitimate 34685587Sobrien union. should be safer on 64-bit machines and cleaner everywhere. 34785587Sobrien (thanks to nelson beebe for pointing out some of these problems.) 34885587Sobrien 34985587Sobrien replaced nested comments by #if 0...#endif in run.c, lib.c. 35085587Sobrien 35185587Sobrien removed getsval, setsval, execute macros from run.c and lib.c. 35285587Sobrien machines are 100x faster than they were when these macros were 35385587Sobrien first used. 35485587Sobrien 35585587Sobrien revised filenames: awk.g.y => awkgram.y, awk.lx.l => awklex.l, 35685587Sobrien y.tab.[ch] => ytab.[ch], lex.yy.c => lexyy.c, all in the aid of 35785587Sobrien portability to nameless systems. 35885587Sobrien 35985587Sobrien "make bundle" now includes yacc and lex output files for recipients 36085587Sobrien who don't have yacc or lex. 36185587Sobrien 36285587SobrienAug 15, 1995: 36385587Sobrien initialized Cells in setsymtab more carefully; some fields 36485587Sobrien were not set. (thanks to purify, all of whose complaints i 36585587Sobrien think i now understand.) 36685587Sobrien 36785587Sobrien fixed at least one error in gsub that looked at -1-th element 36885587Sobrien of an array when substituting for a null match (e.g., $). 36985587Sobrien 37085587Sobrien delete arrayname is now legal; it clears the elements but leaves 37185587Sobrien the array, which may not be the right behavior. 37285587Sobrien 37385587Sobrien modified makefile: my current make can't cope with the test used 37485587Sobrien to avoid unnecessary yacc invocations. 37585587Sobrien 37685587SobrienJul 17, 1995: 37785587Sobrien added dynamically growing strings to awk.lx.l and b.c 37885587Sobrien to permit regular expressions to be much bigger. 37985587Sobrien the state arrays can still overflow. 38085587Sobrien 38185587SobrienAug 24, 1994: 38285587Sobrien detect duplicate arguments in function definitions (mdm). 38385587Sobrien 38485587SobrienMay 11, 1994: 38585587Sobrien trivial fix to printf to limit string size in sub(). 38685587Sobrien 38785587SobrienApr 22, 1994: 38885587Sobrien fixed yet another subtle self-assignment problem: 38985587Sobrien $1 = $2; $1 = $1 clobbered $1. 39085587Sobrien 39185587Sobrien Regression tests now use private echo, to avoid quoting problems. 39285587Sobrien 39385587SobrienFeb 2, 1994: 39485587Sobrien changed error() to print line number as %d, not %g. 39585587Sobrien 39685587SobrienJul 23, 1993: 39785587Sobrien cosmetic changes: increased sizes of some arrays, 39885587Sobrien reworded some error messages. 39985587Sobrien 40085587Sobrien added CONVFMT as in posix (just replaced OFMT in getsval) 40185587Sobrien 40285587Sobrien FILENAME is now "" until the first thing that causes a file 40385587Sobrien to be opened. 40485587Sobrien 40585587SobrienNov 28, 1992: 40685587Sobrien deleted yyunput and yyoutput from proto.h; 40785587Sobrien different versions of lex give these different declarations. 40885587Sobrien 40985587SobrienMay 31, 1992: 41085587Sobrien added -mr N and -mf N options: more record and fields. 41185587Sobrien these really ought to adjust automatically. 41285587Sobrien 41385587Sobrien cleaned up some error messages; "out of space" now means 41485587Sobrien malloc returned NULL in all cases. 41585587Sobrien 41685587Sobrien changed rehash so that if it runs out, it just returns; 41785587Sobrien things will continue to run slow, but maybe a bit longer. 41885587Sobrien 41985587SobrienApr 24, 1992: 42085587Sobrien remove redundant close of stdin when using -f -. 42185587Sobrien 42285587Sobrien got rid of core dump with -d; awk -d just prints date. 42385587Sobrien 42485587SobrienApr 12, 1992: 42585587Sobrien added explicit check for /dev/std(in,out,err) in redirection. 42685587Sobrien unlike gawk, no /dev/fd/n yet. 42785587Sobrien 42885587Sobrien added (file/pipe) builtin. hard to test satisfactorily. 42985587Sobrien not posix. 43085587Sobrien 43185587SobrienFeb 20, 1992: 43285587Sobrien recompile after abortive changes; should be unchanged. 43385587Sobrien 43485587SobrienDec 2, 1991: 43585587Sobrien die-casting time: converted to ansi C, installed that. 43685587Sobrien 43785587SobrienNov 30, 1991: 43885587Sobrien fixed storage leak in freefa, failing to recover [N]CCL. 43985587Sobrien thanks to Bill Jones (jones@cs.usask.ca) 44085587Sobrien 44185587SobrienNov 19, 1991: 44285587Sobrien use RAND_MAX instead of literal in builtin(). 44385587Sobrien 44485587SobrienNov 12, 1991: 44585587Sobrien cranked up some fixed-size arrays in b.c, and added a test for 44685587Sobrien overflow in penter. thanks to mark larsen. 44785587Sobrien 44885587SobrienSep 24, 1991: 44985587Sobrien increased buffer in gsub. a very crude fix to a general problem. 45085587Sobrien and again on Sep 26. 45185587Sobrien 45285587SobrienAug 18, 1991: 45385587Sobrien enforce variable name syntax for commandline variables: has to 45485587Sobrien start with letter or _. 45585587Sobrien 45685587SobrienJul 27, 1991: 45785587Sobrien allow newline after ; in for statements. 45885587Sobrien 45985587SobrienJul 21, 1991: 46085587Sobrien fixed so that in self-assignment like $1=$1, side effects 46185587Sobrien like recomputing $0 take place. (this is getting subtle.) 46285587Sobrien 46385587SobrienJun 30, 1991: 46485587Sobrien better test for detecting too-long output record. 46585587Sobrien 46685587SobrienJun 2, 1991: 46785587Sobrien better defense against very long printf strings. 46885587Sobrien made break and continue illegal outside of loops. 46985587Sobrien 47085587SobrienMay 13, 1991: 47185587Sobrien removed extra arg on gettemp, tempfree. minor error message rewording. 47285587Sobrien 47385587SobrienMay 6, 1991: 47485587Sobrien fixed silly bug in hex parsing in hexstr(). 47585587Sobrien removed an apparently unnecessary test in isnumber(). 47685587Sobrien warn about weird printf conversions. 47785587Sobrien fixed unchecked array overwrite in relex(). 47885587Sobrien 47985587Sobrien changed for (i in array) to access elements in sorted order. 48085587Sobrien then unchanged it -- it really does run slower in too many cases. 48185587Sobrien left the code in place, commented out. 48285587Sobrien 48385587SobrienFeb 10, 1991: 48485587Sobrien check error status on all writes, to avoid banging on full disks. 48585587Sobrien 48685587SobrienJan 28, 1991: 48785587Sobrien awk -f - reads the program from stdin. 48885587Sobrien 48985587SobrienJan 11, 1991: 49085587Sobrien failed to set numeric state on $0 in cmd|getline context in run.c. 49185587Sobrien 49285587SobrienNov 2, 1990: 49385587Sobrien fixed sleazy test for integrality in getsval; use modf. 49485587Sobrien 49585587SobrienOct 29, 1990: 49685587Sobrien fixed sleazy buggy code in lib.c that looked (incorrectly) for 49785587Sobrien too long input lines. 49885587Sobrien 49985587SobrienOct 14, 1990: 50085587Sobrien fixed the bug on p. 198 in which it couldn't deduce that an 50185587Sobrien argument was an array in some contexts. replaced the error 50285587Sobrien message in intest() by code that damn well makes it an array. 50385587Sobrien 50485587SobrienOct 8, 1990: 50585587Sobrien fixed horrible bug: types and values were not preserved in 50685587Sobrien some kinds of self-assignment. (in assign().) 50785587Sobrien 50885587SobrienAug 24, 1990: 50985587Sobrien changed NCHARS to 256 to handle 8-bit characters in strings 51085587Sobrien presented to match(), etc. 51185587Sobrien 51285587SobrienJun 26, 1990: 51385587Sobrien changed struct rrow (awk.h) to use long instead of int for lval, 51485587Sobrien since cfoll() stores a pointer in it. now works better when int's 51585587Sobrien are smaller than pointers! 51685587Sobrien 51785587SobrienMay 6, 1990: 51885587Sobrien AVA fixed the grammar so that ! is uniformly of the same precedence as 51985587Sobrien unary + and -. This renders illegal some constructs like !x=y, which 52085587Sobrien now has to be parenthesized as !(x=y), and makes others work properly: 52185587Sobrien !x+y is (!x)+y, and x!y is x !y, not two pattern-action statements. 52285587Sobrien (These problems were pointed out by Bob Lenk of Posix.) 52385587Sobrien 52485587Sobrien Added \x to regular expressions (already in strings). 52585587Sobrien Limited octal to octal digits; \8 and \9 are not octal. 52685587Sobrien Centralized the code for parsing escapes in regular expressions. 52785587Sobrien Added a bunch of tests to T.re and T.sub to verify some of this. 52885587Sobrien 52985587SobrienFeb 9, 1990: 53085587Sobrien fixed null pointer dereference bug in main.c: -F[nothing]. sigh. 53185587Sobrien 53285587Sobrien restored srand behavior: it returns the current seed. 53385587Sobrien 53485587SobrienJan 18, 1990: 53585587Sobrien srand now returns previous seed value (0 to start). 53685587Sobrien 53785587SobrienJan 5, 1990: 53885587Sobrien fix potential problem in tran.c -- something was freed, 53985587Sobrien then used in freesymtab. 54085587Sobrien 54185587SobrienOct 18, 1989: 54285587Sobrien another try to get the max number of open files set with 54385587Sobrien relatively machine-independent code. 54485587Sobrien 54585587Sobrien small fix to input() in case of multiple reads after EOF. 54685587Sobrien 54785587SobrienOct 11, 1989: 54885587Sobrien FILENAME is now defined in the BEGIN block -- too many old 54985587Sobrien programs broke. 55085587Sobrien 55185587Sobrien "-" means stdin in getline as well as on the commandline. 55285587Sobrien 55385587Sobrien added a bunch of casts to the code to tell the truth about 55485587Sobrien char * vs. unsigned char *, a right royal pain. added a 55585587Sobrien setlocale call to the front of main, though probably no one 55685587Sobrien has it usefully implemented yet. 55785587Sobrien 55885587SobrienAug 24, 1989: 55985587Sobrien removed redundant relational tests against nullnode if parse 56085587Sobrien tree already had a relational at that point. 56185587Sobrien 56285587SobrienAug 11, 1989: 56385587Sobrien fixed bug: commandline variable assignment has to look like 56485587Sobrien var=something. (consider the man page for =, in file =.1) 56585587Sobrien 56685587Sobrien changed number of arguments to functions to static arrays 56785587Sobrien to avoid repeated malloc calls. 56885587Sobrien 56985587SobrienAug 2, 1989: 57085587Sobrien restored -F (space) separator 57185587Sobrien 57285587SobrienJul 30, 1989: 57385587Sobrien added -v x=1 y=2 ... for immediate commandline variable assignment; 57485587Sobrien done before the BEGIN block for sure. they have to precede the 57585587Sobrien program if the program is on the commandline. 57685587Sobrien Modified Aug 2 to require a separate -v for each assignment. 57785587Sobrien 57885587SobrienJul 10, 1989: 57985587Sobrien fixed ref-thru-zero bug in environment code in tran.c 58085587Sobrien 58185587SobrienJun 23, 1989: 58285587Sobrien add newline to usage message. 58385587Sobrien 58485587SobrienJun 14, 1989: 58585587Sobrien added some missing ansi printf conversion letters: %i %X %E %G. 58685587Sobrien no sensible meaning for h or L, so they may not do what one expects. 58785587Sobrien 58885587Sobrien made %* conversions work. 58985587Sobrien 59085587Sobrien changed x^y so that if n is a positive integer, it's done 59185587Sobrien by explicit multiplication, thus achieving maximum accuracy. 59285587Sobrien (this should be done by pow() but it seems not to be locally.) 59385587Sobrien done to x ^= y as well. 59485587Sobrien 59585587SobrienJun 4, 1989: 59685587Sobrien ENVIRON array contains environment: if shell variable V=thing, 59785587Sobrien ENVIRON["V"] is "thing" 59885587Sobrien 59985587Sobrien multiple -f arguments permitted. error reporting is naive. 60085587Sobrien (they were permitted before, but only the last was used.) 60185587Sobrien 60285587Sobrien fixed a really stupid botch in the debugging macro dprintf 60385587Sobrien 60485587Sobrien fixed order of evaluation of commandline assignments to match 60585587Sobrien what the book claims: an argument of the form x=e is evaluated 60685587Sobrien at the time it would have been opened if it were a filename (p 63). 60785587Sobrien this invalidates the suggested answer to ex 4-1 (p 195). 60885587Sobrien 60985587Sobrien removed some code that permitted -F (space) fieldseparator, 61085587Sobrien since it didn't quite work right anyway. (restored aug 2) 61185587Sobrien 61285587SobrienApr 27, 1989: 61385587Sobrien Line number now accumulated correctly for comment lines. 61485587Sobrien 61585587SobrienApr 26, 1989: 61685587Sobrien Debugging output now includes a version date, 61785587Sobrien if one compiles it into the source each time. 61885587Sobrien 61985587SobrienApr 9, 1989: 62085587Sobrien Changed grammar to prohibit constants as 3rd arg of sub and gsub; 62185587Sobrien prevents class of overwriting-a-constant errors. (Last one?) 62285587Sobrien This invalidates the "banana" example on page 43 of the book. 62385587Sobrien 62485587Sobrien Added \a ("alert"), \v (vertical tab), \xhhh (hexadecimal), 62585587Sobrien as in ANSI, for strings. Rescinded the sloppiness that permitted 62685587Sobrien non-octal digits in \ooo. Warning: not all compilers and libraries 62785587Sobrien will be able to deal with \x correctly. 62885587Sobrien 62985587SobrienJan 9, 1989: 63085587Sobrien Fixed bug that caused tempcell list to contain a duplicate. 63185587Sobrien The fix is kludgy. 63285587Sobrien 63385587SobrienDec 17, 1988: 63485587Sobrien Catches some more commandline errors in main. 63585587Sobrien Removed redundant decl of modf in run.c (confuses some compilers). 63685587Sobrien Warning: there's no single declaration of malloc, etc., in awk.h 63785587Sobrien that seems to satisfy all compilers. 63885587Sobrien 63985587SobrienDec 7, 1988: 64085587Sobrien Added a bit of code to error printing to avoid printing nulls. 64185587Sobrien (Not clear that it actually would.) 64285587Sobrien 64385587SobrienNov 27, 1988: 64485587Sobrien With fear and trembling, modified the grammar to permit 64585587Sobrien multiple pattern-action statements on one line without 64685587Sobrien an explicit separator. By definition, this capitulation 64785587Sobrien to the ghost of ancient implementations remains undefined 64885587Sobrien and thus subject to change without notice or apology. 64985587Sobrien DO NOT COUNT ON IT. 65085587Sobrien 65185587SobrienOct 30, 1988: 65285587Sobrien Fixed bug in call() that failed to recover storage. 65385587Sobrien 65485587Sobrien A warning is now generated if there are more arguments 65585587Sobrien in the call than in the definition (in lieu of fixing 65685587Sobrien another storage leak). 65785587Sobrien 65885587SobrienOct 20, 1988: 65985587Sobrien Fixed %c: if expr is numeric, use numeric value; 66085587Sobrien otherwise print 1st char of string value. still 66185587Sobrien doesn't work if the value is 0 -- won't print \0. 66285587Sobrien 66385587Sobrien Added a few more checks for running out of malloc. 66485587Sobrien 66585587SobrienOct 12, 1988: 66685587Sobrien Fixed bug in call() that freed local arrays twice. 66785587Sobrien 66885587Sobrien Fixed to handle deletion of non-existent array right; 66985587Sobrien complains about attempt to delete non-array element. 67085587Sobrien 67185587SobrienSep 30, 1988: 67285587Sobrien Now guarantees to evaluate all arguments of built-in 67385587Sobrien functions, as in C; the appearance is that arguments 67485587Sobrien are evaluated before the function is called. Places 67585587Sobrien affected are sub (gsub was ok), substr, printf, and 67685587Sobrien all the built-in arithmetic functions in bltin(). 67785587Sobrien A warning is generated if a bltin() is called with 67885587Sobrien the wrong number of arguments. 67985587Sobrien 68085587Sobrien This requires changing makeprof on p167 of the book. 68185587Sobrien 68285587SobrienAug 23, 1988: 68385587Sobrien setting FILENAME in BEGIN caused core dump, apparently 68485587Sobrien because it was freeing space not allocated by malloc. 68585587Sobrien 68685587SobrienJuly 24, 1988: 68785587Sobrien fixed egregious error in toupper/tolower functions. 68885587Sobrien still subject to rescinding, however. 68985587Sobrien 69085587SobrienJuly 2, 1988: 69185587Sobrien flush stdout before opening file or pipe 69285587Sobrien 69385587SobrienJuly 2, 1988: 69485587Sobrien performance bug in b.c/cgoto(): not freeing some sets of states. 69585587Sobrien partial fix only right now, and the number of states increased 69685587Sobrien to make it less obvious. 69785587Sobrien 69885587SobrienJune 1, 1988: 69985587Sobrien check error status on close 70085587Sobrien 70185587SobrienMay 28, 1988: 70285587Sobrien srand returns seed value it's using. 70385587Sobrien see 1/18/90 70485587Sobrien 70585587SobrienMay 22, 1988: 70685587Sobrien Removed limit on depth of function calls. 70785587Sobrien 70885587SobrienMay 10, 1988: 70985587Sobrien Fixed lib.c to permit _ in commandline variable names. 71085587Sobrien 71185587SobrienMar 25, 1988: 71285587Sobrien main.c fixed to recognize -- as terminator of command- 71385587Sobrien line options. Illegal options flagged. 71485587Sobrien Error reporting slightly cleaned up. 71585587Sobrien 71685587SobrienDec 2, 1987: 71785587Sobrien Newer C compilers apply a strict scope rule to extern 71885587Sobrien declarations within functions. Two extern declarations in 71985587Sobrien lib.c and tran.c have been moved to obviate this problem. 72085587Sobrien 72185587SobrienOct xx, 1987: 72285587Sobrien Reluctantly added toupper and tolower functions. 72385587Sobrien Subject to rescinding without notice. 72485587Sobrien 72585587SobrienSep 17, 1987: 72685587Sobrien Error-message printer had printf(s) instead of 72785587Sobrien printf("%s",s); got core dumps when the message 72885587Sobrien included a %. 72985587Sobrien 73085587SobrienSep 12, 1987: 73185587Sobrien Very long printf strings caused core dump; 73285587Sobrien fixed aprintf, asprintf, format to catch them. 73385587Sobrien Can still get a core dump in printf itself. 73485587Sobrien 73585587Sobrien 736