FIXES revision 244988
1219820Sjeff/**************************************************************** 2219820SjeffCopyright (C) Lucent Technologies 1997 3219820SjeffAll Rights Reserved 4219820Sjeff 5219820SjeffPermission to use, copy, modify, and distribute this software and 6219820Sjeffits documentation for any purpose and without fee is hereby 7219820Sjeffgranted, provided that the above copyright notice appear in all 8219820Sjeffcopies and that both that the copyright notice and this 9219820Sjeffpermission notice and warranty disclaimer appear in supporting 10219820Sjeffdocumentation, and that the name Lucent Technologies or any of 11219820Sjeffits entities not be used in advertising or publicity pertaining 12219820Sjeffto distribution of the software without specific, written prior 13219820Sjeffpermission. 14219820Sjeff 15219820SjeffLUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 16219820SjeffINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. 17219820SjeffIN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY 18219820SjeffSPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 19219820SjeffWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 20219820SjeffIN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 21219820SjeffARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 22219820SjeffTHIS SOFTWARE. 23219820Sjeff****************************************************************/ 24219820Sjeff 25219820SjeffThis file lists all bug fixes, changes, etc., made since the AWK book 26219820Sjeffwas sent to the printers in August, 1987. 27219820Sjeff 28219820SjeffDec 20, 2012: 29219820Sjeff fiddled makefile to get correct yacc and bison flags. pick yacc 30219820Sjeff (linux) or bison (mac) as necessary. 31219820Sjeff 32219820Sjeff added __attribute__((__noreturn__)) to a couple of lines in 33219820Sjeff proto.h, to silence someone's enthusiastic checker. 34219820Sjeff 35219820Sjeff fixed obscure call by value bug in split(a[1],a) reported on 36219820Sjeff 9fans. the management of temporary values is just a mess; i 37219820Sjeff took a shortcut by making an extra string copy. thanks 38219820Sjeff to paul patience and arnold robbins for passing it on and for 39219820Sjeff proposed patches. 40219820Sjeff 41219820Sjeff tiny fiddle in setfval to eliminate -0 results in T.expr, which 42219820Sjeff has irritated me for 20+ years. 43219820Sjeff 44219820SjeffAug 10, 2011: 45219820Sjeff another fix to avoid core dump with delete(ARGV); again, many thanks 46219820Sjeff to ruslan ermilov. 47219820Sjeff 48219820SjeffAug 7, 2011: 49219820Sjeff split(s, a, //) now behaves the same as split(s, a, "") 50219820Sjeff 51219820SjeffJun 12, 2011: 52219820Sjeff /pat/, \n /pat/ {...} is now legal, though bad style to use. 53219820Sjeff 54219820Sjeff added checks to new -v code that permits -vnospace; thanks to 55219820Sjeff ruslan ermilov for spotting this and providing the patch. 56219820Sjeff 57219820Sjeff removed fixed limit on number of open files; thanks to aleksey 58219820Sjeff cheusov and christos zoulos. 59219820Sjeff 60219820Sjeff fixed day 1 bug that resurrected deleted elements of ARGV when 61219820Sjeff used as filenames (in lib.c). 62219820Sjeff 63219820Sjeff minor type fiddles to make gcc -Wall -pedantic happier (but not 64219820Sjeff totally so); turned on -fno-strict-aliasing in makefile. 65219820Sjeff 66219820SjeffMay 6, 2011: 67219820Sjeff added #ifdef for isblank. 68219820Sjeff now allows -ffoo as well as -f foo arguments. 69219820Sjeff (thanks, ruslan) 70219820Sjeff 71219820SjeffMay 1, 2011: 72219820Sjeff after advice from todd miller, kevin lo, ruslan ermilov, 73219820Sjeff and arnold robbins, changed srand() to return the previous 74219820Sjeff seed (which is 1 on the first call of srand). the seed is 75219820Sjeff an Awkfloat internally though converted to unsigned int to 76219820Sjeff pass to the library srand(). thanks, everyone. 77219820Sjeff 78219820Sjeff fixed a subtle (and i hope low-probability) overflow error 79219820Sjeff in fldbld, by adding space for one extra \0. thanks to 80219820Sjeff robert bassett for spotting this one and providing a fix. 81219820Sjeff 82219820Sjeff removed the files related to compilation on windows. i no 83219820Sjeff longer have anything like a current windows environment, so 84219820Sjeff i can't test any of it. 85219820Sjeff 86219820SjeffMay 23, 2010: 87219820Sjeff fixed long-standing overflow bug in run.c; many thanks to 88219820Sjeff nelson beebe for spotting it and providing the fix. 89219820Sjeff 90219820Sjeff fixed bug that didn't parse -vd=1 properly; thanks to santiago 91219820Sjeff vila for spotting it. 92219820Sjeff 93219820SjeffFeb 8, 2010: 94219820Sjeff i give up. replaced isblank with isspace in b.c; there are 95219820Sjeff no consistent header files. 96219820Sjeff 97219820SjeffNov 26, 2009: 98219820Sjeff fixed a long-standing issue with when FS takes effect. a 99219820Sjeff change to FS is now noticed immediately for subsequent splits. 100219820Sjeff 101219820Sjeff changed the name getline() to awkgetline() to avoid yet another 102219820Sjeff name conflict somewhere. 103219820Sjeff 104219820SjeffFeb 11, 2009: 105219820Sjeff temporarily for now defined HAS_ISBLANK, since that seems to 106219820Sjeff be the best way through the thicket. isblank arrived in C99, 107219820Sjeff but seems to be arriving at different systems at different 108219820Sjeff times. 109219820Sjeff 110219820SjeffOct 8, 2008: 111219820Sjeff fixed typo in b.c that set tmpvec wrongly. no one had ever 112219820Sjeff run into the problem, apparently. thanks to alistair crooks. 113219820Sjeff 114219820SjeffOct 23, 2007: 115219820Sjeff minor fix in lib.c: increase inputFS to 100, change malloc 116219820Sjeff for fields to n+1. 117219820Sjeff 118219820Sjeff fixed memory fault caused by out of order test in setsval. 119219820Sjeff 120219820Sjeff thanks to david o'brien, freebsd, for both fixes. 121219820Sjeff 122219820SjeffMay 1, 2007: 123219820Sjeff fiddle in makefile to fix for BSD make; thanks to igor sobrado. 124219820Sjeff 125219820SjeffMar 31, 2007: 126219820Sjeff fixed some null pointer refs calling adjbuf. 127219820Sjeff 128219820SjeffFeb 21, 2007: 129219820Sjeff fixed a bug in matching the null RE in sub and gsub. thanks to al aho 130219820Sjeff who actually did the fix (in b.c), and to wolfgang seeberg for finding 131219820Sjeff it and providing a very compact test case. 132219820Sjeff 133219820Sjeff fixed quotation in b.c; thanks to Hal Pratt and the Princeton Dante 134219820Sjeff Project. 135219820Sjeff 136219820Sjeff removed some no-effect asserts in run.c. 137219820Sjeff 138219820Sjeff fiddled maketab.c to not complain about bison-generated values. 139219820Sjeff 140219820Sjeff removed the obsolete -V argument; fixed --version to print the 141219820Sjeff version and exit. 142219820Sjeff 143219820Sjeff fixed wording and an outright error in the usage message; thanks to igor 144219820Sjeff sobrado and jason mcintyre. 145219820Sjeff 146219820Sjeff fixed a bug in -d that caused core dump if no program followed. 147219820Sjeff 148219820SjeffJan 1, 2007: 149219820Sjeff dropped mac.code from makefile; there are few non-MacOSX 150219820Sjeff mac's these days. 151219820Sjeff 152219820SjeffJan 17, 2006: 153219820Sjeff system() not flagged as unsafe in the unadvertised -safe option. 154219820Sjeff found it while enhancing tests before shipping the ;login: article. 155219820Sjeff practice what you preach. 156219820Sjeff 157219820Sjeff removed the 9-years-obsolete -mr and -mf flags. 158219820Sjeff 159219820Sjeff added -version and --version options. 160219820Sjeff 161219820Sjeff core dump on linux with BEGIN {nextfile}, now fixed. 162219820Sjeff 163219820Sjeff removed some #ifdef's in run.c and lex.c that appear to no 164219820Sjeff longer be necessary. 165219820Sjeff 166219820SjeffApr 24, 2005: 167219820Sjeff modified lib.c so that values of $0 et al are preserved in the END 168219820Sjeff block, apparently as required by posix. thanks to havard eidnes 169219820Sjeff for the report and code. 170219820Sjeff 171219820SjeffJan 14, 2005: 172219820Sjeff fixed infinite loop in parsing, originally found by brian tsang. 173219820Sjeff thanks to arnold robbins for a suggestion that started me 174219820Sjeff rethinking it. 175219820Sjeff 176219820SjeffDec 31, 2004: 177219820Sjeff prevent overflow of -f array in main, head off potential error in 178219820Sjeff call of SYNTAX(), test malloc return in lib.c, all with thanks to 179219820Sjeff todd miller. 180219820Sjeff 181219820SjeffDec 22, 2004: 182219820Sjeff cranked up size of NCHARS; coverity thinks it can be overrun with 183219820Sjeff smaller size, and i think that's right. added some assertions to b.c 184219820Sjeff to catch places where it might overrun. the RE code is still fragile. 185219820Sjeff 186219820SjeffDec 5, 2004: 187219820Sjeff fixed a couple of overflow problems with ridiculous field numbers: 188219820Sjeff e.g., print $(2^32-1). thanks to ruslan ermilov, giorgos keramidas 189219820Sjeff and david o'brien at freebsd.org for patches. this really should 190219820Sjeff be re-done from scratch. 191219820Sjeff 192219820SjeffNov 21, 2004: 193219820Sjeff fixed another 25-year-old RE bug, in split. it's another failure 194219820Sjeff to (re-)initialize. thanks to steve fisher for spotting this and 195219820Sjeff providing a good test case. 196219820Sjeff 197219820SjeffNov 22, 2003: 198219820Sjeff fixed a bug in regular expressions that dates (so help me) from 1977; 199219820Sjeff it's been there from the beginning. an anchored longest match that 200219820Sjeff was longer than the number of states triggered a failure to initialize 201219820Sjeff the machine properly. many thanks to moinak ghosh for not only finding 202219820Sjeff this one but for providing a fix, in some of the most mysterious 203219820Sjeff code known to man. 204219820Sjeff 205219820Sjeff fixed a storage leak in call() that appears to have been there since 206219820Sjeff 1983 or so -- a function without an explicit return that assigns a 207219820Sjeff string to a parameter leaked a Cell. thanks to moinak ghosh for 208219820Sjeff spotting this very subtle one. 209219820Sjeff 210219820SjeffJul 31, 2003: 211219820Sjeff fixed, thanks to andrey chernov and ruslan ermilov, a bug in lex.c 212219820Sjeff that mis-handled the character 255 in input. (it was being compared 213219820Sjeff to EOF with a signed comparison.) 214219820Sjeff 215219820SjeffJul 29, 2003: 216219820Sjeff fixed (i think) the long-standing botch that included the beginning of 217219820Sjeff line state ^ for RE's in the set of valid characters; this led to a 218219820Sjeff variety of odd problems, including failure to properly match certain 219219820Sjeff regular expressions in non-US locales. thanks to ruslan for keeping 220219820Sjeff at this one. 221219820Sjeff 222219820SjeffJul 28, 2003: 223219820Sjeff n-th try at getting internationalization right, with thanks to volker 224219820Sjeff kiefel, arnold robbins and ruslan ermilov for advice, though they 225219820Sjeff should not be blamed for the outcome. according to posix, "." is the 226219820Sjeff radix character in programs and command line arguments regardless of 227219820Sjeff the locale; otherwise, the locale should prevail for input and output 228219820Sjeff of numbers. so it's intended to work that way. 229219820Sjeff 230219820Sjeff i have rescinded the attempt to use strcoll in expanding shorthands in 231219820Sjeff regular expressions (cclenter). its properties are much too 232219820Sjeff surprising; for example [a-c] matches aAbBc in locale en_US but abBcC 233219820Sjeff in locale fr_CA. i can see how this might arise by implementation 234219820Sjeff but i cannot explain it to a human user. (this behavior can be seen 235219820Sjeff in gawk as well; we're leaning on the same library.) 236219820Sjeff 237219820Sjeff the issue appears to be that strcoll is meant for sorting, where 238219820Sjeff merging upper and lower case may make sense (though note that unix 239219820Sjeff sort does not do this by default either). it is not appropriate 240219820Sjeff for regular expressions, where the goal is to match specific 241219820Sjeff patterns of characters. in any case, the notations [:lower:], etc., 242219820Sjeff are available in awk, and they are more likely to work correctly in 243219820Sjeff most locales. 244219820Sjeff 245219820Sjeff a moratorium is hereby declared on internationalization changes. 246219820Sjeff i apologize to friends and colleagues in other parts of the world. 247219820Sjeff i would truly like to get this "right", but i don't know what 248219820Sjeff that is, and i do not want to keep making changes until it's clear. 249219820Sjeff 250219820SjeffJul 4, 2003: 251219820Sjeff fixed bug that permitted non-terminated RE, as in "awk /x". 252219820Sjeff 253219820SjeffJun 1, 2003: 254219820Sjeff subtle change to split: if source is empty, number of elems 255219820Sjeff is always 0 and the array is not set. 256219820Sjeff 257219820SjeffMar 21, 2003: 258219820Sjeff added some parens to isblank, in another attempt to make things 259219820Sjeff internationally portable. 260219820Sjeff 261219820SjeffMar 14, 2003: 262219820Sjeff the internationalization changes, somewhat modified, are now 263219820Sjeff reinstated. in theory awk will now do character comparisons 264219820Sjeff and case conversions in national language, but "." will always 265219820Sjeff be the decimal point separator on input and output regardless 266219820Sjeff of national language. isblank(){} has an #ifndef. 267219820Sjeff 268219820Sjeff this no longer compiles on windows: LC_MESSAGES isn't defined 269219820Sjeff in vc6++. 270219820Sjeff 271219820Sjeff fixed subtle behavior in field and record splitting: if FS is 272219820Sjeff a single character and RS is not empty, \n is NOT a separator. 273219820Sjeff this tortuous reading is found in the awk book; behavior now 274219820Sjeff matches gawk and mawk. 275219820Sjeff 276219820SjeffDec 13, 2002: 277219820Sjeff for the moment, the internationalization changes of nov 29 are 278219820Sjeff rolled back -- programs like x = 1.2 don't work in some locales, 279219820Sjeff because the parser is expecting x = 1,2. until i understand this 280219820Sjeff better, this will have to wait. 281219820Sjeff 282219820SjeffNov 29, 2002: 283219820Sjeff modified b.c (with tiny changes in main and run) to support 284219820Sjeff locales, using strcoll and iswhatever tests for posix character 285219820Sjeff classes. thanks to ruslan ermilov (ru@freebsd.org) for code. 286219820Sjeff the function isblank doesn't seem to have propagated to any 287219820Sjeff header file near me, so it's there explicitly. not properly 288219820Sjeff tested on non-ascii character sets by me. 289219820Sjeff 290219820SjeffJun 28, 2002: 291219820Sjeff modified run/format() and tran/getsval() to do a slightly better 292219820Sjeff job on using OFMT for output from print and CONVFMT for other 293219820Sjeff number->string conversions, as promised by posix and done by 294219820Sjeff gawk and mawk. there are still places where it doesn't work 295219820Sjeff right if CONVFMT is changed; by then the STR attribute of the 296219820Sjeff variable has been irrevocably set. thanks to arnold robbins for 297219820Sjeff code and examples. 298219820Sjeff 299219820Sjeff fixed subtle bug in format that could get core dump. thanks to 300219820Sjeff Jaromir Dolecek <jdolecek@NetBSD.org> for finding and fixing. 301219820Sjeff minor cleanup in run.c / format() at the same time. 302219820Sjeff 303219820Sjeff added some tests for null pointers to debugging printf's, which 304219820Sjeff were never intended for external consumption. thanks to dave 305219820Sjeff kerns (dkerns@lucent.com) for pointing this out. 306219820Sjeff 307219820Sjeff GNU compatibility: an empty regexp matches anything (thanks to 308219820Sjeff dag-erling smorgrav, des@ofug.org). subject to reversion if 309219820Sjeff this does more harm than good. 310219820Sjeff 311219820Sjeff pervasive small changes to make things more const-correct, as 312219820Sjeff reported by gcc's -Wwrite-strings. as it says in the gcc manual, 313219820Sjeff this may be more nuisance than useful. provoked by a suggestion 314219820Sjeff and code from arnaud desitter, arnaud@nimbus.geog.ox.ac.uk 315219820Sjeff 316219820Sjeff minor documentation changes to note that this now compiles out 317219820Sjeff of the box on Mac OS X. 318219820Sjeff 319219820SjeffFeb 10, 2002: 320219820Sjeff changed types in posix chars structure to quiet solaris cc. 321219820Sjeff 322219820SjeffJan 1, 2002: 323219820Sjeff fflush() or fflush("") flushes all files and pipes. 324219820Sjeff 325219820Sjeff length(arrayname) returns number of elements; thanks to 326219820Sjeff arnold robbins for suggestion. 327219820Sjeff 328219820Sjeff added a makefile.win to make it easier to build on windows. 329219820Sjeff based on dan allen's buildwin.bat. 330219820Sjeff 331219820SjeffNov 16, 2001: 332219820Sjeff added support for posix character class names like [:digit:], 333219820Sjeff which are not exactly shorter than [0-9] and perhaps no more 334219820Sjeff portable. thanks to dag-erling smorgrav for code. 335219820Sjeff 336219820SjeffFeb 16, 2001: 337219820Sjeff removed -m option; no longer needed, and it was actually 338219820Sjeff broken (noted thanks to volker kiefel). 339219820Sjeff 340219820SjeffFeb 10, 2001: 341219820Sjeff fixed an appalling bug in gettok: any sequence of digits, +,-, E, e, 342219820Sjeff and period was accepted as a valid number if it started with a period. 343219820Sjeff this would never have happened with the lex version. 344219820Sjeff 345219820Sjeff other 1-character botches, now fixed, include a bare $ and a 346219820Sjeff bare " at the end of the input. 347219820Sjeff 348219820SjeffFeb 7, 2001: 349219820Sjeff more (const char *) casts in b.c and tran.c to silence warnings. 350219820Sjeff 351219820SjeffNov 15, 2000: 352219820Sjeff fixed a bug introduced in august 1997 that caused expressions 353219820Sjeff like $f[1] to be syntax errors. thanks to arnold robbins for 354219820Sjeff noticing this and providing a fix. 355219820Sjeff 356219820SjeffOct 30, 2000: 357219820Sjeff fixed some nextfile bugs: not handling all cases. thanks to 358219820Sjeff arnold robbins for pointing this out. new regressions added. 359219820Sjeff 360219820Sjeff close() is now a function. it returns whatever the library 361219820Sjeff fclose returns, and -1 for closing a file or pipe that wasn't 362219820Sjeff opened. 363219820Sjeff 364219820SjeffSep 24, 2000: 365219820Sjeff permit \n explicitly in character classes; won't work right 366219820Sjeff if comes in as "[\n]" but ok as /[\n]/, because of multiple 367219820Sjeff processing of \'s. thanks to arnold robbins. 368219820Sjeff 369219820SjeffJuly 5, 2000: 370219820Sjeff minor fiddles in tran.c to keep compilers happy about uschar. 371219820Sjeff thanks to norman wilson. 372219820Sjeff 373219820SjeffMay 25, 2000: 374219820Sjeff yet another attempt at making 8-bit input work, with another 375219820Sjeff band-aid in b.c (member()), and some (uschar) casts to head 376219820Sjeff off potential errors in subscripts (like isdigit). also 377219820Sjeff changed HAT to NCHARS-2. thanks again to santiago vila. 378219820Sjeff 379219820Sjeff changed maketab.c to ignore apparently out of range definitions 380219820Sjeff instead of halting; new freeBSD generates one. thanks to 381219820Sjeff jon snader <jsnader@ix.netcom.com> for pointing out the problem. 382219820Sjeff 383219820SjeffMay 2, 2000: 384219820Sjeff fixed an 8-bit problem in b.c by making several char*'s into 385219820Sjeff unsigned char*'s. not clear i have them all yet. thanks to 386219820Sjeff Santiago Vila <sanvila@unex.es> for the bug report. 387219820Sjeff 388219820SjeffApr 21, 2000: 389219820Sjeff finally found and fixed a memory leak in function call; it's 390219820Sjeff been there since functions were added ~1983. thanks to 391219820Sjeff jon bentley for the test case that found it. 392219820Sjeff 393219820Sjeff added test in envinit to catch environment "variables" with 394219820Sjeff names beginning with '='; thanks to Berend Hasselman. 395219820Sjeff 396219820SjeffJul 28, 1999: 397219820Sjeff added test in defn() to catch function foo(foo), which 398219820Sjeff otherwise recurses until core dump. thanks to arnold 399219820Sjeff robbins for noticing this. 400219820Sjeff 401219820SjeffJun 20, 1999: 402219820Sjeff added *bp in gettok in lex.c; appears possible to exit function 403219820Sjeff without terminating the string. thanks to russ cox. 404219820Sjeff 405219820SjeffJun 2, 1999: 406219820Sjeff added function stdinit() to run to initialize files[] array, 407219820Sjeff in case stdin, etc., are not constants; some compilers care. 408219820Sjeff 409219820SjeffMay 10, 1999: 410219820Sjeff replaced the ERROR ... FATAL, etc., macros with functions 411219820Sjeff based on vprintf, to avoid problems caused by overrunning 412219820Sjeff fixed-size errbuf array. thanks to ralph corderoy for the 413219820Sjeff impetus, and for pointing out a string termination bug in 414219820Sjeff qstring as well. 415219820Sjeff 416219820SjeffApr 21, 1999: 417219820Sjeff fixed bug that caused occasional core dumps with commandline 418219820Sjeff variable with value ending in \. (thanks to nelson beebe for 419219820Sjeff the test case.) 420219820Sjeff 421219820SjeffApr 16, 1999: 422219820Sjeff with code kindly provided by Bruce Lilly, awk now parses 423219820Sjeff /=/ and similar constructs more sensibly in more places. 424219820Sjeff Bruce also provided some helpful test cases. 425219820Sjeff 426219820SjeffApr 5, 1999: 427219820Sjeff changed true/false to True/False in run.c to make it 428219820Sjeff easier to compile with C++. Added some casts on malloc 429219820Sjeff and realloc to be honest about casts; ditto. changed 430219820Sjeff ltype int to long in struct rrow to reduce some 64-bit 431219820Sjeff complaints; other changes scattered throughout for the 432219820Sjeff same purpose. thanks to Nelson Beebe for these portability 433219820Sjeff improvements. 434219820Sjeff 435219820Sjeff removed some horrible pointer-int casting in b.c and elsewhere 436219820Sjeff by adding ptoi and itonp to localize the casts, which are 437219820Sjeff all benign. fixed one incipient bug that showed up on sgi 438219820Sjeff in 64-bit mode. 439219820Sjeff 440219820Sjeff reset lineno for new source file; include filename in error 441219820Sjeff message. also fixed line number error in continuation lines. 442219820Sjeff (thanks to Nelson Beebe for both of these.) 443219820Sjeff 444219820SjeffMar 24, 1999: 445219820Sjeff Nelson Beebe notes that irix 5.3 yacc dies with a bogus 446219820Sjeff error; use a newer version or switch to bison, since sgi 447219820Sjeff is unlikely to fix it. 448219820Sjeff 449219820SjeffMar 5, 1999: 450219820Sjeff changed isnumber to is_number to avoid the problem caused by 451219820Sjeff versions of ctype.h that include the name isnumber. 452219820Sjeff 453219820Sjeff distribution now includes a script for building on a Mac, 454219820Sjeff thanks to Dan Allen. 455219820Sjeff 456219820SjeffFeb 20, 1999: 457219820Sjeff fixed memory leaks in run.c (call) and tran.c (setfval). 458219820Sjeff thanks to Stephen Nutt for finding these and providing the fixes. 459219820Sjeff 460219820SjeffJan 13, 1999: 461219820Sjeff replaced srand argument by (unsigned int) in run.c; 462219820Sjeff avoids problem on Mac and potentially on Unix & Windows. 463219820Sjeff thanks to Dan Allen. 464219820Sjeff 465219820Sjeff added a few (int) casts to silence useless compiler warnings. 466219820Sjeff e.g., errorflag= in run.c jump(). 467219820Sjeff 468219820Sjeff added proctab.c to the bundle outout; one less thing 469219820Sjeff to have to compile out of the box. 470219820Sjeff 471219820Sjeff added calls to _popen and _pclose to the win95 stub for 472219820Sjeff pipes (thanks to Steve Adams for this helpful suggestion). 473219820Sjeff seems to work, though properties are not well understood 474219820Sjeff by me, and it appears that under some circumstances the 475219820Sjeff pipe output is truncated. Be careful. 476219820Sjeff 477219820SjeffOct 19, 1998: 478219820Sjeff fixed a couple of bugs in getrec: could fail to update $0 479219820Sjeff after a getline var; because inputFS wasn't initialized, 480219820Sjeff could split $0 on every character, a misleading diversion. 481219820Sjeff 482219820Sjeff fixed caching bug in makedfa: LRU was actually removing 483219820Sjeff least often used. 484219820Sjeff 485219820Sjeff thanks to ross ridge for finding these, and for providing 486219820Sjeff great bug reports. 487219820Sjeff 488219820SjeffMay 12, 1998: 489219820Sjeff fixed potential bug in readrec: might fail to update record 490219820Sjeff pointer after growing. thanks to dan levy for spotting this 491219820Sjeff and suggesting the fix. 492219820Sjeff 493219820SjeffMar 12, 1998: 494219820Sjeff added -V to print version number and die. 495219820Sjeff 496219820SjeffFeb 11, 1998: 497219820Sjeff subtle silent bug in lex.c: if the program ended with a number 498219820Sjeff longer than 1 digit, part of the input would be pushed back and 499219820Sjeff parsed again because token buffer wasn't terminated right. 500219820Sjeff example: awk 'length($0) > 10'. blush. at least i found it 501219820Sjeff myself. 502219820Sjeff 503219820SjeffAug 31, 1997: 504219820Sjeff s/adelete/awkdelete/: SGI uses this in malloc.h. 505219820Sjeff thanks to nelson beebe for pointing this one out. 506219820Sjeff 507219820SjeffAug 21, 1997: 508219820Sjeff fixed some bugs in sub and gsub when replacement includes \\. 509219820Sjeff this is a dark, horrible corner, but at least now i believe that 510219820Sjeff the behavior is the same as gawk and the intended posix standard. 511219820Sjeff thanks to arnold robbins for advice here. 512219820Sjeff 513219820SjeffAug 9, 1997: 514219820Sjeff somewhat regretfully, replaced the ancient lex-based lexical 515219820Sjeff analyzer with one written in C. it's longer, generates less code, 516219820Sjeff and more portable; the old one depended too much on mysterious 517219820Sjeff properties of lex that were not preserved in other environments. 518219820Sjeff in theory these recognize the same language. 519219820Sjeff 520219820Sjeff now using strtod to test whether a string is a number, instead of 521219820Sjeff the convoluted original function. should be more portable and 522219820Sjeff reliable if strtod is implemented right. 523219820Sjeff 524219820Sjeff removed now-pointless optimization in makefile that tries to avoid 525219820Sjeff recompilation when awkgram.y is changed but symbols are not. 526219820Sjeff 527219820Sjeff removed most fixed-size arrays, though a handful remain, some 528219820Sjeff of which are unchecked. you have been warned. 529219820Sjeff 530219820SjeffAug 4, 1997: 531219820Sjeff with some trepidation, replaced the ancient code that managed 532219820Sjeff fields and $0 in fixed-size arrays with arrays that grow on 533219820Sjeff demand. there is still some tension between trying to make this 534219820Sjeff run fast and making it clean; not sure it's right yet. 535219820Sjeff 536219820Sjeff the ill-conceived -mr and -mf arguments are now useful only 537219820Sjeff for debugging. previous dynamic string code removed. 538219820Sjeff 539219820Sjeff numerous other minor cleanups along the way. 540219820Sjeff 541219820SjeffJul 30, 1997: 542219820Sjeff using code provided by dan levy (to whom profuse thanks), replaced 543219820Sjeff fixed-size arrays and awkward kludges by a fairly uniform mechanism 544219820Sjeff to grow arrays as needed for printf, sub, gsub, etc. 545219820Sjeff 546219820SjeffJul 23, 1997: 547219820Sjeff falling off the end of a function returns "" and 0, not 0. 548219820Sjeff thanks to arnold robbins. 549219820Sjeff 550219820SjeffJun 17, 1997: 551219820Sjeff replaced several fixed-size arrays by dynamically-created ones 552219820Sjeff in run.c; added overflow tests to some previously unchecked cases. 553219820Sjeff getline, toupper, tolower. 554219820Sjeff 555219820Sjeff getline code is still broken in that recursive calls may wind 556219820Sjeff up using the same space. [fixed later] 557219820Sjeff 558219820Sjeff increased RECSIZE to 8192 to push problems further over the horizon. 559219820Sjeff 560219820Sjeff added \r to \n as input line separator for programs, not data. 561219820Sjeff damn CRLFs. 562219820Sjeff 563219820Sjeff modified format() to permit explicit printf("%c", 0) to include 564219820Sjeff a null byte in output. thanks to ken stailey for the fix. 565219820Sjeff 566219820Sjeff added a "-safe" argument that disables file output (print >, 567219820Sjeff print >>), process creation (cmd|getline, print |, system), and 568219820Sjeff access to the environment (ENVIRON). this is a first approximation 569219820Sjeff to a "safe" version of awk, but don't rely on it too much. thanks 570219820Sjeff to joan feigenbaum and matt blaze for the inspiration long ago. 571219820Sjeff 572219820SjeffJul 8, 1996: 573219820Sjeff fixed long-standing bug in sub, gsub(/a/, "\\\\&"); thanks to 574219820Sjeff ralph corderoy. 575219820Sjeff 576219820SjeffJun 29, 1996: 577219820Sjeff fixed awful bug in new field splitting; didn't get all the places 578219820Sjeff where input was done. 579219820Sjeff 580219820SjeffJun 28, 1996: 581219820Sjeff changed field-splitting to conform to posix definition: fields are 582219820Sjeff split using the value of FS at the time of input; it used to be 583219820Sjeff the value when the field or NF was first referred to, a much less 584219820Sjeff predictable definition. thanks to arnold robbins for encouragement 585219820Sjeff to do the right thing. 586219820Sjeff 587219820SjeffMay 28, 1996: 588219820Sjeff fixed appalling but apparently unimportant bug in parsing octal 589219820Sjeff numbers in reg exprs. 590219820Sjeff 591219820Sjeff explicit hex in reg exprs now limited to 2 chars: \xa, \xaa. 592219820Sjeff 593219820SjeffMay 27, 1996: 594219820Sjeff cleaned up some declarations so gcc -Wall is now almost silent. 595219820Sjeff 596219820Sjeff makefile now includes backup copies of ytab.c and lexyy.c in case 597219820Sjeff one makes before looking; it also avoids recreating lexyy.c unless 598219820Sjeff really needed. 599219820Sjeff 600219820Sjeff s/aprintf/awkprint, s/asprintf/awksprintf/ to avoid some name clashes 601219820Sjeff with unwisely-written header files. 602219820Sjeff 603219820Sjeff thanks to jeffrey friedl for several of these. 604219820Sjeff 605219820SjeffMay 26, 1996: 606219820Sjeff an attempt to rationalize the (unsigned) char issue. almost all 607219820Sjeff instances of unsigned char have been removed; the handful of places 608219820Sjeff in b.c where chars are used as table indices have been hand-crafted. 609219820Sjeff added some latin-1 tests to the regression, but i'm not confident; 610219820Sjeff none of my compilers seem to care much. thanks to nelson beebe for 611219820Sjeff pointing out some others that do care. 612219820Sjeff 613219820SjeffMay 2, 1996: 614219820Sjeff removed all register declarations. 615219820Sjeff 616219820Sjeff enhanced split(), as in gawk, etc: split(s, a, "") splits s into 617219820Sjeff a[1]...a[length(s)] with each character a single element. 618219820Sjeff 619219820Sjeff made the same changes for field-splitting if FS is "". 620219820Sjeff 621219820Sjeff added nextfile, as in gawk: causes immediate advance to next 622219820Sjeff input file. (thanks to arnold robbins for inspiration and code). 623219820Sjeff 624219820Sjeff small fixes to regexpr code: can now handle []], [[], and 625219820Sjeff variants; [] is now a syntax error, rather than matching 626219820Sjeff everything; [z-a] is now empty, not z. far from complete 627219820Sjeff or correct, however. (thanks to jeffrey friedl for pointing out 628219820Sjeff some awful behaviors.) 629219820Sjeff 630219820SjeffApr 29, 1996: 631219820Sjeff replaced uchar by uschar everywhere; apparently some compilers 632219820Sjeff usurp this name and this causes conflicts. 633219820Sjeff 634219820Sjeff fixed call to time in run.c (bltin); arg is time_t *. 635219820Sjeff 636219820Sjeff replaced horrible pointer/long punning in b.c by a legitimate 637219820Sjeff union. should be safer on 64-bit machines and cleaner everywhere. 638219820Sjeff (thanks to nelson beebe for pointing out some of these problems.) 639219820Sjeff 640219820Sjeff replaced nested comments by #if 0...#endif in run.c, lib.c. 641219820Sjeff 642219820Sjeff removed getsval, setsval, execute macros from run.c and lib.c. 643219820Sjeff machines are 100x faster than they were when these macros were 644219820Sjeff first used. 645219820Sjeff 646219820Sjeff revised filenames: awk.g.y => awkgram.y, awk.lx.l => awklex.l, 647219820Sjeff y.tab.[ch] => ytab.[ch], lex.yy.c => lexyy.c, all in the aid of 648219820Sjeff portability to nameless systems. 649219820Sjeff 650219820Sjeff "make bundle" now includes yacc and lex output files for recipients 651219820Sjeff who don't have yacc or lex. 652219820Sjeff 653219820SjeffAug 15, 1995: 654219820Sjeff initialized Cells in setsymtab more carefully; some fields 655219820Sjeff were not set. (thanks to purify, all of whose complaints i 656219820Sjeff think i now understand.) 657219820Sjeff 658219820Sjeff fixed at least one error in gsub that looked at -1-th element 659219820Sjeff of an array when substituting for a null match (e.g., $). 660219820Sjeff 661219820Sjeff delete arrayname is now legal; it clears the elements but leaves 662219820Sjeff the array, which may not be the right behavior. 663219820Sjeff 664219820Sjeff modified makefile: my current make can't cope with the test used 665219820Sjeff to avoid unnecessary yacc invocations. 666219820Sjeff 667219820SjeffJul 17, 1995: 668219820Sjeff added dynamically growing strings to awk.lx.l and b.c 669219820Sjeff to permit regular expressions to be much bigger. 670219820Sjeff the state arrays can still overflow. 671219820Sjeff 672219820SjeffAug 24, 1994: 673219820Sjeff detect duplicate arguments in function definitions (mdm). 674219820Sjeff 675219820SjeffMay 11, 1994: 676219820Sjeff trivial fix to printf to limit string size in sub(). 677219820Sjeff 678219820SjeffApr 22, 1994: 679219820Sjeff fixed yet another subtle self-assignment problem: 680219820Sjeff $1 = $2; $1 = $1 clobbered $1. 681219820Sjeff 682219820Sjeff Regression tests now use private echo, to avoid quoting problems. 683219820Sjeff 684219820SjeffFeb 2, 1994: 685219820Sjeff changed error() to print line number as %d, not %g. 686219820Sjeff 687219820SjeffJul 23, 1993: 688219820Sjeff cosmetic changes: increased sizes of some arrays, 689219820Sjeff reworded some error messages. 690219820Sjeff 691219820Sjeff added CONVFMT as in posix (just replaced OFMT in getsval) 692219820Sjeff 693219820Sjeff FILENAME is now "" until the first thing that causes a file 694219820Sjeff to be opened. 695219820Sjeff 696219820SjeffNov 28, 1992: 697219820Sjeff deleted yyunput and yyoutput from proto.h; 698219820Sjeff different versions of lex give these different declarations. 699219820Sjeff 700219820SjeffMay 31, 1992: 701219820Sjeff added -mr N and -mf N options: more record and fields. 702219820Sjeff these really ought to adjust automatically. 703219820Sjeff 704219820Sjeff cleaned up some error messages; "out of space" now means 705219820Sjeff malloc returned NULL in all cases. 706219820Sjeff 707219820Sjeff changed rehash so that if it runs out, it just returns; 708219820Sjeff things will continue to run slow, but maybe a bit longer. 709219820Sjeff 710219820SjeffApr 24, 1992: 711219820Sjeff remove redundant close of stdin when using -f -. 712219820Sjeff 713219820Sjeff got rid of core dump with -d; awk -d just prints date. 714219820Sjeff 715219820SjeffApr 12, 1992: 716219820Sjeff added explicit check for /dev/std(in,out,err) in redirection. 717219820Sjeff unlike gawk, no /dev/fd/n yet. 718219820Sjeff 719219820Sjeff added (file/pipe) builtin. hard to test satisfactorily. 720219820Sjeff not posix. 721219820Sjeff 722219820SjeffFeb 20, 1992: 723219820Sjeff recompile after abortive changes; should be unchanged. 724219820Sjeff 725219820SjeffDec 2, 1991: 726219820Sjeff die-casting time: converted to ansi C, installed that. 727219820Sjeff 728219820SjeffNov 30, 1991: 729219820Sjeff fixed storage leak in freefa, failing to recover [N]CCL. 730219820Sjeff thanks to Bill Jones (jones@cs.usask.ca) 731219820Sjeff 732219820SjeffNov 19, 1991: 733219820Sjeff use RAND_MAX instead of literal in builtin(). 734219820Sjeff 735219820SjeffNov 12, 1991: 736219820Sjeff cranked up some fixed-size arrays in b.c, and added a test for 737219820Sjeff overflow in penter. thanks to mark larsen. 738219820Sjeff 739219820SjeffSep 24, 1991: 740219820Sjeff increased buffer in gsub. a very crude fix to a general problem. 741219820Sjeff and again on Sep 26. 742219820Sjeff 743219820SjeffAug 18, 1991: 744219820Sjeff enforce variable name syntax for commandline variables: has to 745219820Sjeff start with letter or _. 746219820Sjeff 747219820SjeffJul 27, 1991: 748219820Sjeff allow newline after ; in for statements. 749219820Sjeff 750219820SjeffJul 21, 1991: 751219820Sjeff fixed so that in self-assignment like $1=$1, side effects 752219820Sjeff like recomputing $0 take place. (this is getting subtle.) 753219820Sjeff 754219820SjeffJun 30, 1991: 755219820Sjeff better test for detecting too-long output record. 756219820Sjeff 757219820SjeffJun 2, 1991: 758219820Sjeff better defense against very long printf strings. 759219820Sjeff made break and continue illegal outside of loops. 760219820Sjeff 761219820SjeffMay 13, 1991: 762219820Sjeff removed extra arg on gettemp, tempfree. minor error message rewording. 763219820Sjeff 764219820SjeffMay 6, 1991: 765219820Sjeff fixed silly bug in hex parsing in hexstr(). 766219820Sjeff removed an apparently unnecessary test in isnumber(). 767219820Sjeff warn about weird printf conversions. 768219820Sjeff fixed unchecked array overwrite in relex(). 769219820Sjeff 770219820Sjeff changed for (i in array) to access elements in sorted order. 771219820Sjeff then unchanged it -- it really does run slower in too many cases. 772219820Sjeff left the code in place, commented out. 773219820Sjeff 774219820SjeffFeb 10, 1991: 775219820Sjeff check error status on all writes, to avoid banging on full disks. 776219820Sjeff 777219820SjeffJan 28, 1991: 778219820Sjeff awk -f - reads the program from stdin. 779219820Sjeff 780219820SjeffJan 11, 1991: 781219820Sjeff failed to set numeric state on $0 in cmd|getline context in run.c. 782219820Sjeff 783219820SjeffNov 2, 1990: 784219820Sjeff fixed sleazy test for integrality in getsval; use modf. 785219820Sjeff 786219820SjeffOct 29, 1990: 787219820Sjeff fixed sleazy buggy code in lib.c that looked (incorrectly) for 788219820Sjeff too long input lines. 789219820Sjeff 790219820SjeffOct 14, 1990: 791219820Sjeff fixed the bug on p. 198 in which it couldn't deduce that an 792219820Sjeff argument was an array in some contexts. replaced the error 793219820Sjeff message in intest() by code that damn well makes it an array. 794219820Sjeff 795219820SjeffOct 8, 1990: 796219820Sjeff fixed horrible bug: types and values were not preserved in 797219820Sjeff some kinds of self-assignment. (in assign().) 798219820Sjeff 799219820SjeffAug 24, 1990: 800219820Sjeff changed NCHARS to 256 to handle 8-bit characters in strings 801219820Sjeff presented to match(), etc. 802219820Sjeff 803219820SjeffJun 26, 1990: 804219820Sjeff changed struct rrow (awk.h) to use long instead of int for lval, 805219820Sjeff since cfoll() stores a pointer in it. now works better when int's 806219820Sjeff are smaller than pointers! 807219820Sjeff 808219820SjeffMay 6, 1990: 809219820Sjeff AVA fixed the grammar so that ! is uniformly of the same precedence as 810219820Sjeff unary + and -. This renders illegal some constructs like !x=y, which 811219820Sjeff now has to be parenthesized as !(x=y), and makes others work properly: 812219820Sjeff !x+y is (!x)+y, and x!y is x !y, not two pattern-action statements. 813219820Sjeff (These problems were pointed out by Bob Lenk of Posix.) 814219820Sjeff 815219820Sjeff Added \x to regular expressions (already in strings). 816219820Sjeff Limited octal to octal digits; \8 and \9 are not octal. 817219820Sjeff Centralized the code for parsing escapes in regular expressions. 818219820Sjeff Added a bunch of tests to T.re and T.sub to verify some of this. 819219820Sjeff 820219820SjeffFeb 9, 1990: 821219820Sjeff fixed null pointer dereference bug in main.c: -F[nothing]. sigh. 822219820Sjeff 823219820Sjeff restored srand behavior: it returns the current seed. 824219820Sjeff 825219820SjeffJan 18, 1990: 826219820Sjeff srand now returns previous seed value (0 to start). 827219820Sjeff 828219820SjeffJan 5, 1990: 829219820Sjeff fix potential problem in tran.c -- something was freed, 830219820Sjeff then used in freesymtab. 831219820Sjeff 832219820SjeffOct 18, 1989: 833219820Sjeff another try to get the max number of open files set with 834219820Sjeff relatively machine-independent code. 835219820Sjeff 836219820Sjeff small fix to input() in case of multiple reads after EOF. 837219820Sjeff 838219820SjeffOct 11, 1989: 839219820Sjeff FILENAME is now defined in the BEGIN block -- too many old 840219820Sjeff programs broke. 841219820Sjeff 842219820Sjeff "-" means stdin in getline as well as on the commandline. 843219820Sjeff 844219820Sjeff added a bunch of casts to the code to tell the truth about 845219820Sjeff char * vs. unsigned char *, a right royal pain. added a 846219820Sjeff setlocale call to the front of main, though probably no one 847219820Sjeff has it usefully implemented yet. 848219820Sjeff 849219820SjeffAug 24, 1989: 850219820Sjeff removed redundant relational tests against nullnode if parse 851219820Sjeff tree already had a relational at that point. 852219820Sjeff 853219820SjeffAug 11, 1989: 854219820Sjeff fixed bug: commandline variable assignment has to look like 855219820Sjeff var=something. (consider the man page for =, in file =.1) 856219820Sjeff 857219820Sjeff changed number of arguments to functions to static arrays 858219820Sjeff to avoid repeated malloc calls. 859219820Sjeff 860219820SjeffAug 2, 1989: 861219820Sjeff restored -F (space) separator 862219820Sjeff 863219820SjeffJul 30, 1989: 864219820Sjeff added -v x=1 y=2 ... for immediate commandline variable assignment; 865219820Sjeff done before the BEGIN block for sure. they have to precede the 866219820Sjeff program if the program is on the commandline. 867219820Sjeff Modified Aug 2 to require a separate -v for each assignment. 868219820Sjeff 869219820SjeffJul 10, 1989: 870219820Sjeff fixed ref-thru-zero bug in environment code in tran.c 871219820Sjeff 872219820SjeffJun 23, 1989: 873219820Sjeff add newline to usage message. 874219820Sjeff 875219820SjeffJun 14, 1989: 876219820Sjeff added some missing ansi printf conversion letters: %i %X %E %G. 877219820Sjeff no sensible meaning for h or L, so they may not do what one expects. 878219820Sjeff 879219820Sjeff made %* conversions work. 880219820Sjeff 881219820Sjeff changed x^y so that if n is a positive integer, it's done 882219820Sjeff by explicit multiplication, thus achieving maximum accuracy. 883219820Sjeff (this should be done by pow() but it seems not to be locally.) 884219820Sjeff done to x ^= y as well. 885219820Sjeff 886219820SjeffJun 4, 1989: 887219820Sjeff ENVIRON array contains environment: if shell variable V=thing, 888219820Sjeff ENVIRON["V"] is "thing" 889219820Sjeff 890219820Sjeff multiple -f arguments permitted. error reporting is naive. 891219820Sjeff (they were permitted before, but only the last was used.) 892219820Sjeff 893219820Sjeff fixed a really stupid botch in the debugging macro dprintf 894219820Sjeff 895219820Sjeff fixed order of evaluation of commandline assignments to match 896219820Sjeff what the book claims: an argument of the form x=e is evaluated 897219820Sjeff at the time it would have been opened if it were a filename (p 63). 898219820Sjeff this invalidates the suggested answer to ex 4-1 (p 195). 899219820Sjeff 900219820Sjeff removed some code that permitted -F (space) fieldseparator, 901219820Sjeff since it didn't quite work right anyway. (restored aug 2) 902219820Sjeff 903219820SjeffApr 27, 1989: 904219820Sjeff Line number now accumulated correctly for comment lines. 905219820Sjeff 906219820SjeffApr 26, 1989: 907219820Sjeff Debugging output now includes a version date, 908219820Sjeff if one compiles it into the source each time. 909219820Sjeff 910219820SjeffApr 9, 1989: 911219820Sjeff Changed grammar to prohibit constants as 3rd arg of sub and gsub; 912219820Sjeff prevents class of overwriting-a-constant errors. (Last one?) 913219820Sjeff This invalidates the "banana" example on page 43 of the book. 914219820Sjeff 915219820Sjeff Added \a ("alert"), \v (vertical tab), \xhhh (hexadecimal), 916219820Sjeff as in ANSI, for strings. Rescinded the sloppiness that permitted 917219820Sjeff non-octal digits in \ooo. Warning: not all compilers and libraries 918219820Sjeff will be able to deal with \x correctly. 919219820Sjeff 920219820SjeffJan 9, 1989: 921219820Sjeff Fixed bug that caused tempcell list to contain a duplicate. 922219820Sjeff The fix is kludgy. 923219820Sjeff 924219820SjeffDec 17, 1988: 925219820Sjeff Catches some more commandline errors in main. 926219820Sjeff Removed redundant decl of modf in run.c (confuses some compilers). 927219820Sjeff Warning: there's no single declaration of malloc, etc., in awk.h 928219820Sjeff that seems to satisfy all compilers. 929219820Sjeff 930219820SjeffDec 7, 1988: 931219820Sjeff Added a bit of code to error printing to avoid printing nulls. 932219820Sjeff (Not clear that it actually would.) 933219820Sjeff 934219820SjeffNov 27, 1988: 935219820Sjeff With fear and trembling, modified the grammar to permit 936219820Sjeff multiple pattern-action statements on one line without 937219820Sjeff an explicit separator. By definition, this capitulation 938219820Sjeff to the ghost of ancient implementations remains undefined 939219820Sjeff and thus subject to change without notice or apology. 940219820Sjeff DO NOT COUNT ON IT. 941219820Sjeff 942219820SjeffOct 30, 1988: 943219820Sjeff Fixed bug in call() that failed to recover storage. 944219820Sjeff 945219820Sjeff A warning is now generated if there are more arguments 946219820Sjeff in the call than in the definition (in lieu of fixing 947219820Sjeff another storage leak). 948219820Sjeff 949219820SjeffOct 20, 1988: 950219820Sjeff Fixed %c: if expr is numeric, use numeric value; 951219820Sjeff otherwise print 1st char of string value. still 952219820Sjeff doesn't work if the value is 0 -- won't print \0. 953219820Sjeff 954219820Sjeff Added a few more checks for running out of malloc. 955219820Sjeff 956219820SjeffOct 12, 1988: 957219820Sjeff Fixed bug in call() that freed local arrays twice. 958219820Sjeff 959219820Sjeff Fixed to handle deletion of non-existent array right; 960219820Sjeff complains about attempt to delete non-array element. 961219820Sjeff 962219820SjeffSep 30, 1988: 963219820Sjeff Now guarantees to evaluate all arguments of built-in 964219820Sjeff functions, as in C; the appearance is that arguments 965219820Sjeff are evaluated before the function is called. Places 966219820Sjeff affected are sub (gsub was ok), substr, printf, and 967219820Sjeff all the built-in arithmetic functions in bltin(). 968219820Sjeff A warning is generated if a bltin() is called with 969219820Sjeff the wrong number of arguments. 970219820Sjeff 971219820Sjeff This requires changing makeprof on p167 of the book. 972219820Sjeff 973219820SjeffAug 23, 1988: 974219820Sjeff setting FILENAME in BEGIN caused core dump, apparently 975219820Sjeff because it was freeing space not allocated by malloc. 976219820Sjeff 977219820SjeffJuly 24, 1988: 978219820Sjeff fixed egregious error in toupper/tolower functions. 979219820Sjeff still subject to rescinding, however. 980219820Sjeff 981219820SjeffJuly 2, 1988: 982219820Sjeff flush stdout before opening file or pipe 983219820Sjeff 984219820SjeffJuly 2, 1988: 985219820Sjeff performance bug in b.c/cgoto(): not freeing some sets of states. 986219820Sjeff partial fix only right now, and the number of states increased 987219820Sjeff to make it less obvious. 988219820Sjeff 989219820SjeffJune 1, 1988: 990219820Sjeff check error status on close 991219820Sjeff 992219820SjeffMay 28, 1988: 993219820Sjeff srand returns seed value it's using. 994219820Sjeff see 1/18/90 995219820Sjeff 996219820SjeffMay 22, 1988: 997219820Sjeff Removed limit on depth of function calls. 998219820Sjeff 999219820SjeffMay 10, 1988: 1000219820Sjeff Fixed lib.c to permit _ in commandline variable names. 1001219820Sjeff 1002219820SjeffMar 25, 1988: 1003219820Sjeff main.c fixed to recognize -- as terminator of command- 1004219820Sjeff line options. Illegal options flagged. 1005219820Sjeff Error reporting slightly cleaned up. 1006219820Sjeff 1007219820SjeffDec 2, 1987: 1008219820Sjeff Newer C compilers apply a strict scope rule to extern 1009219820Sjeff declarations within functions. Two extern declarations in 1010219820Sjeff lib.c and tran.c have been moved to obviate this problem. 1011219820Sjeff 1012219820SjeffOct xx, 1987: 1013219820Sjeff Reluctantly added toupper and tolower functions. 1014219820Sjeff Subject to rescinding without notice. 1015219820Sjeff 1016219820SjeffSep 17, 1987: 1017219820Sjeff Error-message printer had printf(s) instead of 1018219820Sjeff printf("%s",s); got core dumps when the message 1019219820Sjeff included a %. 1020219820Sjeff 1021219820SjeffSep 12, 1987: 1022219820Sjeff Very long printf strings caused core dump; 1023219820Sjeff fixed aprintf, asprintf, format to catch them. 1024219820Sjeff Can still get a core dump in printf itself. 1025 1026 1027