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