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