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