1f32a6403SWarner Losh/**************************************************************** 2f32a6403SWarner LoshCopyright (C) Lucent Technologies 1997 3f32a6403SWarner LoshAll Rights Reserved 4f32a6403SWarner Losh 5f32a6403SWarner LoshPermission to use, copy, modify, and distribute this software and 6f32a6403SWarner Loshits documentation for any purpose and without fee is hereby 7f32a6403SWarner Loshgranted, provided that the above copyright notice appear in all 8f32a6403SWarner Loshcopies and that both that the copyright notice and this 9f32a6403SWarner Loshpermission notice and warranty disclaimer appear in supporting 10f32a6403SWarner Loshdocumentation, and that the name Lucent Technologies or any of 11f32a6403SWarner Loshits entities not be used in advertising or publicity pertaining 12f32a6403SWarner Loshto distribution of the software without specific, written prior 13f32a6403SWarner Loshpermission. 14f32a6403SWarner Losh 15f32a6403SWarner LoshLUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 16f32a6403SWarner LoshINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. 17f32a6403SWarner LoshIN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY 18f32a6403SWarner LoshSPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 19f32a6403SWarner LoshWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 20f32a6403SWarner LoshIN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 21f32a6403SWarner LoshARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 22f32a6403SWarner LoshTHIS SOFTWARE. 23f32a6403SWarner Losh****************************************************************/ 24f32a6403SWarner Losh 25f32a6403SWarner LoshThis file lists all bug fixes, changes, etc., made since the AWK book 26f32a6403SWarner Loshwas sent to the printers in August 1987. 27f32a6403SWarner Losh 28f32a6403SWarner LoshSep 06, 2023: 29f32a6403SWarner Losh Fix edge case where FS is changed on commandline. Thanks to 30f32a6403SWarner Losh Gordon Shephard and Miguel Pineiro Jr. 31f32a6403SWarner Losh 32f32a6403SWarner Losh Fix regular expression clobbering in the lexer, where lexer does 33f32a6403SWarner Losh not make a copy of regexp literals. also makedfa memory leaks have 34f32a6403SWarner Losh been plugged. Thanks to Miguel Pineiro Jr. 35f32a6403SWarner Losh 36f32a6403SWarner LoshDec 15, 2022: 37f32a6403SWarner Losh Force hex escapes in strings to be no more than two characters, 38f32a6403SWarner Losh as they already are in regular expressions. This brings internal 39f32a6403SWarner Losh consistency, as well as consistency with gawk. Thanks to 40f32a6403SWarner Losh Arnold Robbins. 41f32a6403SWarner Losh 42f32a6403SWarner LoshSep 12, 2022: 43f32a6403SWarner Losh adjbuf minlen error (cannot be 0) in cat, resulting in NULL pbuf. 44f32a6403SWarner Losh discovered by todd miller. also use-after-free issue with 45f32a6403SWarner Losh tempfree in cat, thanks to Miguel Pineiro Jr and valgrind. 46f32a6403SWarner Losh 47f32a6403SWarner LoshAug 30, 2022: 48f32a6403SWarner Losh Various leaks and use-after-free issues plugged/fixed. 49f32a6403SWarner Losh Thanks to Miguel Pineiro Jr. <mpj@pineiro.cc>. 50f32a6403SWarner Losh 51f32a6403SWarner LoshMay 23, 2022: 52f32a6403SWarner Losh Memory leak when assigning a string to some of the built-in 53f32a6403SWarner Losh variables. allocated string erroneously marked DONTFREE. 54f32a6403SWarner Losh Thanks to Miguel Pineiro Jr. <mpj@pineiro.cc>. 55f32a6403SWarner Losh 56f32a6403SWarner LoshMar 14, 2022: 57f32a6403SWarner Losh Historic bug: command-line "name=value" assignment had been 58f32a6403SWarner Losh truncating its entry in ARGV. (circa 1989) Thanks to 59f32a6403SWarner Losh Miguel Pineiro Jr. <mpj@pineiro.cc>. 60f32a6403SWarner Losh 61f32a6403SWarner LoshMar 3, 2022: 62f32a6403SWarner Losh Fixed file management memory leak that appears to have been 63f32a6403SWarner Losh there since the files array was first initialized with stdin, 64f32a6403SWarner Losh stdout, and stderr (circa 1992). Thanks to Miguel Pineiro Jr. 65f32a6403SWarner Losh <mpj@pineiro.cc>. 66f32a6403SWarner Losh 67f32a6403SWarner LoshDecember 8, 2021: 68f32a6403SWarner Losh The error handling in closefile and closeall was mangled. Long 69f32a6403SWarner Losh standing warnings had been made fatal and some fatal errors went 70f32a6403SWarner Losh undetected. Thanks to Miguel Pineiro Jr. <mpj@pineiro.cc>. 71f32a6403SWarner Losh 72f32a6403SWarner LoshNov 03, 2021: 73f32a6403SWarner Losh getline accesses uninitialized data after getrec() 74f32a6403SWarner Losh returns 0 on EOF and leaves the contents of buf unchanged. 75f32a6403SWarner Losh Thanks to Volodymyr Gubarkov, and Todd C Miller. 76f32a6403SWarner Losh 77f32a6403SWarner LoshOct 12, 2021: 78f32a6403SWarner Losh The fix for #83 changed the code to insert 2 chars, but the 79f32a6403SWarner Losh call to adjbuf just above it only allows for 1 char. This can 80f32a6403SWarner Losh cause a heap buffer overflow. 81f32a6403SWarner Losh 82f32a6403SWarner LoshJuly 27, 2021: 83f32a6403SWarner Losh As per IEEE Std 1003.1-2008, -F "str" is now consistent with 84f32a6403SWarner Losh -v FS="str" when str is null. Thanks to Warner Losh. 85f32a6403SWarner Losh 86f32a6403SWarner LoshJuly 24, 2021: 87f32a6403SWarner Losh Fix readrec's definition of a record. This fixes an issue 88f32a6403SWarner Losh with NetBSD's RS regular expression support that can cause 89f32a6403SWarner Losh an infinite read loop. Thanks to Miguel Pineiro Jr. 90f32a6403SWarner Losh 91f32a6403SWarner Losh Fix regular expression RS ^-anchoring. RS ^-anchoring needs to 92f32a6403SWarner Losh know if it is reading the first record of a file. This change 93f32a6403SWarner Losh restores a missing line that was overlooked when porting NetBSD's 94f32a6403SWarner Losh RS regex functionality. Thanks to Miguel Pineiro Jr. 95f32a6403SWarner Losh 96f32a6403SWarner Losh Fix size computation in replace_repeat() for special case 97f32a6403SWarner Losh REPEAT_WITH_Q. Thanks to Todd C. Miller. 98f32a6403SWarner Losh 99f32a6403SWarner LoshFebruary 15, 2021: 100f32a6403SWarner Losh Small fix so that awk will compile again with g++. Thanks to 101f32a6403SWarner Losh Arnold Robbins. 102f32a6403SWarner Losh 103f32a6403SWarner LoshJanuary 06, 2021: 104f32a6403SWarner Losh Fix a decision bug with trailing stuff in lib.c:is_valid_number 105f32a6403SWarner Losh after recent changes. Thanks to Ozan Yigit. 106f32a6403SWarner Losh 107f32a6403SWarner LoshDecember 18, 2020: 108f32a6403SWarner Losh Fix problems converting inf and NaN values in lib.c:is_valid_number. 109f32a6403SWarner Losh Enhance number to string conversion to do the right thing for 110f32a6403SWarner Losh NaN and inf values. Things are now pretty much the same as in 111f32a6403SWarner Losh gawk. (Found a gawk bug while we're at it.) Added a torture 112f32a6403SWarner Losh test for these values. Thanks to Arnold Robbins. Allows closing 113f32a6403SWarner Losh of PR #101. 114f32a6403SWarner Losh 115f32a6403SWarner LoshDecember 15, 2020: 116f32a6403SWarner Losh Merge PR #99, which gets the right header for strcasecmp. 117f32a6403SWarner Losh Thanks to GitHub user michaelforney. 118f32a6403SWarner Losh 119f32a6403SWarner LoshDecember 8, 2020: 120f32a6403SWarner Losh Merge PR #98: Disallow hex data. Allow only +nan, -nan, 121f32a6403SWarner Losh +inf, -inf (case independent) to give NaN and infinity values. 122f32a6403SWarner Losh Improve things so that string to double conversion is only 123f32a6403SWarner Losh done once, yielding something of a speedup. This obviate 124f32a6403SWarner Losh PR #95. Thanks to Arnold Robbins. 125f32a6403SWarner Losh 126f32a6403SWarner LoshDecember 3, 2020: 127f32a6403SWarner Losh Fix to argument parsing to avoid printing spurious newlines. 128f32a6403SWarner Losh Thanks to Todd Miller. Merges PR #97. 129f32a6403SWarner Losh 130f32a6403SWarner LoshOctober 13, 2020: 131f32a6403SWarner Losh Add casts before all the calls to malloc/calloc/realloc in order 132f32a6403SWarner Losh to get it to compile with g++. Thanks to Arnold Robbins. 133f32a6403SWarner Losh 134f32a6403SWarner LoshAugust 16, 2020: 135f32a6403SWarner Losh Additional fixes for DJGPP. Thanks to Eli Zaretskii for 136f32a6403SWarner Losh the testing. 137f32a6403SWarner Losh 138f32a6403SWarner LoshAugust 7, 2020: 139f32a6403SWarner Losh Merge PR #93, which adds casts to (void*) for debug prints 140f32a6403SWarner Losh using the %p format specifier. Thanks to GitHub user YongHaoWu 141f32a6403SWarner Losh ("Chris") for the fixes. 142f32a6403SWarner Losh 143f32a6403SWarner LoshAugust 4, 2020: 144f32a6403SWarner Losh In run.c, use non-restartable multibyte routines to attain 145f32a6403SWarner Losh portability to DJGPP. Should fix Issue 92. Thanks to Albert Wik 146f32a6403SWarner Losh for the report and to Todd Miller for the suggested fix. 147f32a6403SWarner Losh 148f32a6403SWarner LoshJuly 30, 2020: 149f32a6403SWarner Losh Merge PRs 88-91 which fix small bugs. Thanks to Todd Miller and 150f32a6403SWarner Losh Tim van der Molen for the fixes. 151f32a6403SWarner Losh 152f32a6403SWarner Losh In order to make life easier, we move exclusively to bison 153f32a6403SWarner Losh as the parser generator. 154f32a6403SWarner Losh 155f32a6403SWarner LoshJuly 2, 2020: 156f32a6403SWarner Losh Merge PRs 85 and 86 which fix regressions. Thanks to 157f32a6403SWarner Losh Tim van der Molen for the fixes. 158f32a6403SWarner Losh 159f32a6403SWarner LoshJune 25, 2020: 160f32a6403SWarner Losh Merge PRs 82 and 84. The latter fixes issue #83. Thanks to 161f32a6403SWarner Losh Todd Miller and awkfan77. 162f32a6403SWarner Losh 163f32a6403SWarner LoshJune 12, 2020: 164f32a6403SWarner Losh Clear errno before calling errcheck to avoid any spurious errors 165f32a6403SWarner Losh left over from previous calls that may have set it. Thanks to 166f32a6403SWarner Losh Todd Miller for the fix, from PR #80. 167f32a6403SWarner Losh 168f32a6403SWarner Losh Fix Issue #78 by allowing \r to follow floating point numbers in 169f32a6403SWarner Losh lib.c:is_number. Thanks to GitHub user ajcarr for the report 170f32a6403SWarner Losh and to Arnold Robbins for the fix. 171f32a6403SWarner Losh 172f32a6403SWarner LoshJune 5, 2020: 173f32a6403SWarner Losh In fldbld(), make sure that inputFS is set before trying to 174f32a6403SWarner Losh use it. Thanks to Steffen Nurpmeso <steffen@sdaoden.eu> 175f32a6403SWarner Losh for the report. 176f32a6403SWarner Losh 177f32a6403SWarner LoshMay 5, 2020: 178f32a6403SWarner Losh Fix checks for compilers that can handle noreturn. Thanks to 179f32a6403SWarner Losh GitHub user enh-google for pointing it out. Closes Issue #79. 180f32a6403SWarner Losh 181f32a6403SWarner LoshApril 16, 2020: 182f32a6403SWarner Losh Handle old compilers that don't support C11 (for noreturn). 183f32a6403SWarner Losh Thanks to Arnold Robbins. 184f32a6403SWarner Losh 185f32a6403SWarner LoshApril 5, 2020: 186f32a6403SWarner Losh Use <stdnoreturn.h> and noreturn instead of GCC attributes. 187f32a6403SWarner Losh Thanks to GitHub user awkfan77. Closes PR #77. 188f32a6403SWarner Losh 189f32a6403SWarner LoshFebruary 28, 2020: 190f32a6403SWarner Losh More cleanups from Christos Zoulas: notably backslash continuation 191f32a6403SWarner Losh inside strings removes the newline and a fix for RS = "^a". 192f32a6403SWarner Losh Fix for address sanitizer-found problem. Thanks to GitHub user 193f32a6403SWarner Losh enh-google. 194f32a6403SWarner Losh 195f32a6403SWarner LoshFebruary 19, 2020: 196f32a6403SWarner Losh More small cleanups from Christos Zoulas. 197f32a6403SWarner Losh 198f32a6403SWarner LoshFebruary 18, 2020: 199f32a6403SWarner Losh Additional cleanups from Christos Zoulas. It's no longer necessary 200f32a6403SWarner Losh to use the -y flag to bison. 201f32a6403SWarner Losh 202f32a6403SWarner LoshFebruary 6, 2020: 203f32a6403SWarner Losh Additional small cleanups from Christos Zoulas. awk is now 204f32a6403SWarner Losh a little more robust about reporting I/O errors upon exit. 205f32a6403SWarner Losh 206f32a6403SWarner LoshJanuary 31, 2020: 207f32a6403SWarner Losh Merge PR #70, which avoids use of variable length arrays. Thanks 208f32a6403SWarner Losh to GitHub user michaelforney. Fix issue #60 ({0} in interval 209f32a6403SWarner Losh expressions doesn't work). Also get all tests working again. 210f32a6403SWarner Losh Thanks to Arnold Robbins. 211f32a6403SWarner Losh 212f32a6403SWarner LoshJanuary 24, 2020: 213f32a6403SWarner Losh A number of small cleanups from Christos Zoulas. Add the close 214f32a6403SWarner Losh on exec flag to files/pipes opened for redirection; courtesy of 215f32a6403SWarner Losh Arnold Robbins. 216f32a6403SWarner Losh 217f32a6403SWarner LoshJanuary 19, 2020: 218f32a6403SWarner Losh If POSIXLY_CORRECT is set in the environment, then sub and gsub 219f32a6403SWarner Losh use POSIX rules for multiple backslashes. This fixes Issue #66, 220f32a6403SWarner Losh while maintaining backwards compatibility. 221f32a6403SWarner Losh 222f32a6403SWarner LoshJanuary 9, 2020: 223f32a6403SWarner Losh Input/output errors on closing files are now fatal instead of 224f32a6403SWarner Losh mere warnings. Thanks to Martijn Dekker <martijn@inlv.org>. 225f32a6403SWarner Losh 226f32a6403SWarner LoshJanuary 5, 2020: 227*17853db4SWarner Losh Fix a bug in the concatenation of two string constants into 228f32a6403SWarner Losh one done in the grammar. Fixes GitHub issue #61. Thanks 229f32a6403SWarner Losh to GitHub user awkfan77 for pointing out the direction for 230f32a6403SWarner Losh the fix. New test T.concat added to the test suite. 231f32a6403SWarner Losh Fix a few memory leaks reported by valgrind, as well. 232f32a6403SWarner Losh 233f32a6403SWarner LoshDecember 27, 2019: 234f32a6403SWarner Losh Fix a bug whereby a{0,3} could match four a's. Thanks to 235f32a6403SWarner Losh "Anonymous AWK fan" for the report. 236f32a6403SWarner Losh 237f32a6403SWarner LoshDecember 11, 2019: 238f32a6403SWarner Losh Further printf-related fixes for 32 bit systems. 239f32a6403SWarner Losh Thanks again to Christos Zoulas. 240f32a6403SWarner Losh 241f32a6403SWarner LoshDecember 8, 2019: 242f32a6403SWarner Losh Fix the return value of sprintf("%d") on 32 bit systems. 243f32a6403SWarner Losh Thanks to Jim Lowe for the report and to Christos Zoulas 244f32a6403SWarner Losh for the fix. 245f32a6403SWarner Losh 246f32a6403SWarner LoshNovember 10, 2019: 247f32a6403SWarner Losh Convert a number of Boolean integer variables into 248f32a6403SWarner Losh actual bools. Convert compile_time variable into an 249f32a6403SWarner Losh enum and simplify some of the related code. Thanks 250f32a6403SWarner Losh to Arnold Robbins. 251f32a6403SWarner Losh 252f32a6403SWarner LoshNovember 8, 2019: 253f32a6403SWarner Losh Fix from Ori Bernstein to get UTF-8 characters instead of 254f32a6403SWarner Losh bytes when FS = "". This is currently the only bit of 255f32a6403SWarner Losh the One True Awk that understands multibyte characters. 256f32a6403SWarner Losh From Arnold Robbins, apply some cleanups in the test suite. 257f32a6403SWarner Losh 258f32a6403SWarner LoshOctober 25, 2019: 259f32a6403SWarner Losh More fixes and cleanups from NetBSD, courtesy of Christos 260f32a6403SWarner Losh Zoulas. Merges PRs 54 and 55. 261f32a6403SWarner Losh 262f32a6403SWarner LoshOctober 24, 2019: 263f32a6403SWarner Losh Import second round of code cleanups from NetBSD. Much thanks 264f32a6403SWarner Losh to Christos Zoulas (GitHub user zoulasc). Merges PR 53. 265f32a6403SWarner Losh Add an optimization for string concatenation, also from 266f32a6403SWarner Losh Christos. 267f32a6403SWarner Losh 268f32a6403SWarner LoshOctober 17, 2019: 269f32a6403SWarner Losh Import code cleanups from NetBSD. Much thanks to Christos 270f32a6403SWarner Losh Zoulas (GitHub user zoulasc). Merges PR 51. 271f32a6403SWarner Losh 272f32a6403SWarner LoshOctober 6, 2019: 273f32a6403SWarner Losh Import code from NetBSD awk that implements RS as a regular 274f32a6403SWarner Losh expression. 275f32a6403SWarner Losh 276f32a6403SWarner LoshSeptember 10, 2019: 277f32a6403SWarner Losh Fixes for various array / memory overruns found via gcc's 278f32a6403SWarner Losh -fsanitize=unknown. Thanks to Alexander Richardson (GitHub 279f32a6403SWarner Losh user arichardson). Merges PRs 47 and 48. 280f32a6403SWarner Losh 281f32a6403SWarner LoshJuly 28, 2019: 282f32a6403SWarner Losh Import grammar optimization from NetBSD: Two string constants 283f32a6403SWarner Losh concatenated together get turned into a single string. 284f32a6403SWarner Losh 285f32a6403SWarner LoshJuly 26, 2019: 286f32a6403SWarner Losh Support POSIX-specified C-style escape sequences "\a" (alarm) 287f32a6403SWarner Losh and "\v" (vertical tab) in command line arguments and regular 288f32a6403SWarner Losh expressions, further to the support for them in strings added on 289f32a6403SWarner Losh Apr 9, 1989. These now no longer match as literal "a" and "v" 290f32a6403SWarner Losh characters (as they don't on other awk implementations). 291f32a6403SWarner Losh Thanks to Martijn Dekker. 292f32a6403SWarner Losh 293f32a6403SWarner LoshJuly 17, 2019: 294f32a6403SWarner Losh Pull in a number of code cleanups and minor fixes from 295f32a6403SWarner Losh Warner Losh's bsd-ota branch. The only user visible change 296f32a6403SWarner Losh is the use of random(3) as the random number generator. 297f32a6403SWarner Losh Thanks to Warner Losh for collecting all these fixes in 298f32a6403SWarner Losh one easy place to get them from. 299f32a6403SWarner Losh 300f32a6403SWarner LoshJuly 16, 2019: 301f32a6403SWarner Losh Fix field splitting to use FS value as of the time a record 302f32a6403SWarner Losh was read or assigned to. Thanks to GitHub user Cody Mello (melloc) 303f32a6403SWarner Losh for the fix. (Merged from his branch, via PR #42.) Updated 304f32a6403SWarner Losh testdir/T.split per said PR as well. 305f32a6403SWarner Losh 306f32a6403SWarner LoshJune 24, 2019: 307f32a6403SWarner Losh Extract awktest.tar into testdir directory. Add some very 308f32a6403SWarner Losh simple mechanics to the makefile for running the tests and 309f32a6403SWarner Losh for cleaning up. No changes to awk itself. 310f32a6403SWarner Losh 311f32a6403SWarner LoshJune 17, 2019: 312f32a6403SWarner Losh Disallow deleting SYMTAB and its elements, which creates 313f32a6403SWarner Losh use-after-free bugs. Thanks to GitHub user Cody Mello (melloc) 314f32a6403SWarner Losh for the fix. (Merged from PR #43.) 315f32a6403SWarner Losh 316f32a6403SWarner LoshJune 5, 2019: 317f32a6403SWarner Losh Allow unmatched right parenthesis in a regular expression to 318f32a6403SWarner Losh be treated literally. Fixes Issue #40. Thanks to GitHub user 319f32a6403SWarner Losh Warner Losh (bsdimp) for the report. Thanks to Arnold Robbins 320f32a6403SWarner Losh for the fix. 321f32a6403SWarner Losh 322f32a6403SWarner LoshMay 29,2019: 323f32a6403SWarner Losh Fix check for command line arguments to no longer require that 324f32a6403SWarner Losh first character after '=' not be another '='. Reverts change of 325f32a6403SWarner Losh August 11, 1989. Thanks to GitHub user Jamie Landeg Jones for 326f32a6403SWarner Losh pointing out the issue; from Issue #38. 327f32a6403SWarner Losh 328f32a6403SWarner LoshApr 7, 2019: 329f32a6403SWarner Losh Update awktest.tar(p.50) to use modern options to sort. Needed 330f32a6403SWarner Losh for Android development. Thanks to GitHub user mohd-akram (Mohamed 331f32a6403SWarner Losh Akram). From Issue #33. 332f32a6403SWarner Losh 333f32a6403SWarner LoshMar 12, 2019: 334f32a6403SWarner Losh Added very simplistic support for cross-compiling in the 335f32a6403SWarner Losh makefile. We are NOT going to go in the direction of the 336f32a6403SWarner Losh autotools, though. Thanks to GitHub user nee-san for 337f32a6403SWarner Losh the basic change. (Merged from PR #34.) 338f32a6403SWarner Losh 339f32a6403SWarner LoshMar 5, 2019: 340f32a6403SWarner Losh Added support for POSIX-standard interval expressions (a.k.a. 341f32a6403SWarner Losh bounds, a.k.a. repetition expressions) in regular expressions, 342f32a6403SWarner Losh backported (via NetBSD) from Apple awk-24 (20070501). 343f32a6403SWarner Losh Thanks to Martijn Dekker <martijn@inlv.org> for the port. 344f32a6403SWarner Losh (Merged from PR #30.) 345f32a6403SWarner Losh 346f32a6403SWarner LoshMar 3, 2019: 347f32a6403SWarner Losh Merge PRs as follows: 348f32a6403SWarner Losh #12: Avoid undefined behaviour when using ctype(3) functions in 349f32a6403SWarner Losh relex(). Thanks to GitHub user iamleot. 350f32a6403SWarner Losh #31: Make getline handle numeric strings, and update FIXES. Thanks 351f32a6403SWarner Losh to GitHub user Arnold Robbins (arnoldrobbins) 352f32a6403SWarner Losh #32: maketab: support build systems with read-only source. Thanks 353f32a6403SWarner Losh to GitHub user enh. 354f32a6403SWarner Losh 355f32a6403SWarner LoshJan 25, 2019: 356f32a6403SWarner Losh Make getline handle numeric strings properly in all cases. 357f32a6403SWarner Losh (Thanks, Arnold.) 358f32a6403SWarner Losh 359f32a6403SWarner LoshJan 21, 2019: 360f32a6403SWarner Losh Merged a number of small fixes from GitHub pull requests. 361f32a6403SWarner Losh Thanks to GitHub users Arnold Robbins (arnoldrobbins), 362f32a6403SWarner Losh Cody Mello (melloc) and Christoph Junghans (junghans). 363f32a6403SWarner Losh PR numbers: 13-21, 23, 24, 27. 364f32a6403SWarner Losh 365f32a6403SWarner LoshOct 25, 2018: 366f32a6403SWarner Losh Added test in maketab.c to prevent generating a proctab entry 367f32a6403SWarner Losh for YYSTYPE_IS_DEFINED. It was harmless but some gcc settings 368f32a6403SWarner Losh generated a warning message. Thanks to Nan Xiao for report. 369f32a6403SWarner Losh 370f32a6403SWarner LoshAug 27, 2018: 371f32a6403SWarner Losh Disallow '$' in printf formats; arguments evaluated in order 372f32a6403SWarner Losh and printed in order. 373f32a6403SWarner Losh 374f32a6403SWarner Losh Added some casts to silence warnings on debugging printfs. 375f32a6403SWarner Losh (Thanks, Arnold.) 376f32a6403SWarner Losh 377f32a6403SWarner LoshAug 23, 2018: 378f32a6403SWarner Losh A long list of fixes courtesy of Arnold Robbins, 379f32a6403SWarner Losh to whom profound thanks. 380f32a6403SWarner Losh 381f32a6403SWarner Losh 1. ofs-rebuild: OFS value used to rebuild the record was incorrect. 382f32a6403SWarner Losh Fixed August 19, 2014. Revised fix August 2018. 383f32a6403SWarner Losh 384f32a6403SWarner Losh 2. system-status: Instead of a floating-point division by 256, use 385f32a6403SWarner Losh the wait(2) macros to create a reasonable exit status. 386f32a6403SWarner Losh Fixed March 12, 2016. 387f32a6403SWarner Losh 388f32a6403SWarner Losh 3. space: Use provided xisblank() function instead of ispace() for 389f32a6403SWarner Losh matching [[:blank:]]. 390f32a6403SWarner Losh 391f32a6403SWarner Losh 4. a-format: Add POSIX standard %a and %A to supported formats. Check 392f32a6403SWarner Losh at runtime that this format is available. 393f32a6403SWarner Losh 394f32a6403SWarner Losh 5. decr-NF: Decrementing NF did not change $0. This is a decades-old 395f32a6403SWarner Losh bug. There are interactions with the old and new value of OFS as well. 396f32a6403SWarner Losh Most of the fix came from the NetBSD awk. 397f32a6403SWarner Losh 398f32a6403SWarner Losh 6. string-conv: String conversions of scalars were sticky. Once a 399f32a6403SWarner Losh conversion to string happened, even with OFMT, that value was used until 400f32a6403SWarner Losh a new numeric value was assigned, even if OFMT differed from CONVFMT, 401f32a6403SWarner Losh and also if CONVFMT changed. 402f32a6403SWarner Losh 403f32a6403SWarner Losh 7. unary-plus: Unary plus on a string constant returned the string. 404f32a6403SWarner Losh Instead, it should convert the value to numeric and give that value. 405f32a6403SWarner Losh 406f32a6403SWarner Losh Also added Arnold's tests for these to awktest.tar as T.arnold. 407f32a6403SWarner Losh 408f32a6403SWarner LoshAug 15, 2018: 409f32a6403SWarner Losh fixed mangled awktest.tar (thanks, Arnold), posted all 410f32a6403SWarner Losh current (very minor) fixes to github / onetrueawk 411f32a6403SWarner Losh 412f32a6403SWarner LoshJun 7, 2018: 413f32a6403SWarner Losh (yes, a long layoff) 414f32a6403SWarner Losh Updated some broken tests (beebe.tar, T.lilly) 415f32a6403SWarner Losh [thanks to Arnold Robbins] 416f32a6403SWarner Losh 417f32a6403SWarner LoshMar 26, 2015: 418f32a6403SWarner Losh buffer overflow in error reporting; thanks to tobias ulmer 419f32a6403SWarner Losh and john-mark gurney for spotting it and the fix. 420f32a6403SWarner Losh 421f32a6403SWarner LoshFeb 4, 2013: 422f32a6403SWarner Losh cleaned up a handful of tests that didn't seem to actually 423f32a6403SWarner Losh test for correct behavior: T.latin1, T.gawk. 424f32a6403SWarner Losh 425f32a6403SWarner LoshJan 5, 2013: 426f32a6403SWarner Losh added ,NULL initializer to static Cells in run.c; not really 427f32a6403SWarner Losh needed but cleaner. Thanks to Michael Bombardieri. 428f32a6403SWarner Losh 429f32a6403SWarner LoshDec 20, 2012: 430f32a6403SWarner Losh fiddled makefile to get correct yacc and bison flags. pick yacc 431f32a6403SWarner Losh (linux) or bison (mac) as necessary. 432f32a6403SWarner Losh 433f32a6403SWarner Losh added __attribute__((__noreturn__)) to a couple of lines in 434f32a6403SWarner Losh proto.h, to silence someone's enthusiastic checker. 435f32a6403SWarner Losh 436f32a6403SWarner Losh fixed obscure call by value bug in split(a[1],a) reported on 437f32a6403SWarner Losh 9fans. the management of temporary values is just a mess; i 438f32a6403SWarner Losh took a shortcut by making an extra string copy. thanks 439f32a6403SWarner Losh to paul patience and arnold robbins for passing it on and for 440f32a6403SWarner Losh proposed patches. 441f32a6403SWarner Losh 442f32a6403SWarner Losh tiny fiddle in setfval to eliminate -0 results in T.expr, which 443f32a6403SWarner Losh has irritated me for 20+ years. 444f32a6403SWarner Losh 445f32a6403SWarner LoshAug 10, 2011: 446f32a6403SWarner Losh another fix to avoid core dump with delete(ARGV); again, many thanks 447f32a6403SWarner Losh to ruslan ermilov. 448f32a6403SWarner Losh 449f32a6403SWarner LoshAug 7, 2011: 450f32a6403SWarner Losh split(s, a, //) now behaves the same as split(s, a, "") 451f32a6403SWarner Losh 452f32a6403SWarner LoshJun 12, 2011: 453f32a6403SWarner Losh /pat/, \n /pat/ {...} is now legal, though bad style to use. 454f32a6403SWarner Losh 455f32a6403SWarner Losh added checks to new -v code that permits -vnospace; thanks to 456f32a6403SWarner Losh ruslan ermilov for spotting this and providing the patch. 457f32a6403SWarner Losh 458f32a6403SWarner Losh removed fixed limit on number of open files; thanks to aleksey 459f32a6403SWarner Losh cheusov and christos zoulos. 460f32a6403SWarner Losh 461f32a6403SWarner Losh fixed day 1 bug that resurrected deleted elements of ARGV when 462f32a6403SWarner Losh used as filenames (in lib.c). 463f32a6403SWarner Losh 464f32a6403SWarner Losh minor type fiddles to make gcc -Wall -pedantic happier (but not 465f32a6403SWarner Losh totally so); turned on -fno-strict-aliasing in makefile. 466f32a6403SWarner Losh 467f32a6403SWarner LoshMay 6, 2011: 468f32a6403SWarner Losh added #ifdef for isblank. 469f32a6403SWarner Losh now allows -ffoo as well as -f foo arguments. 470f32a6403SWarner Losh (thanks, ruslan) 471f32a6403SWarner Losh 472f32a6403SWarner LoshMay 1, 2011: 473f32a6403SWarner Losh after advice from todd miller, kevin lo, ruslan ermilov, 474f32a6403SWarner Losh and arnold robbins, changed srand() to return the previous 475f32a6403SWarner Losh seed (which is 1 on the first call of srand). the seed is 476f32a6403SWarner Losh an Awkfloat internally though converted to unsigned int to 477f32a6403SWarner Losh pass to the library srand(). thanks, everyone. 478f32a6403SWarner Losh 479f32a6403SWarner Losh fixed a subtle (and i hope low-probability) overflow error 480f32a6403SWarner Losh in fldbld, by adding space for one extra \0. thanks to 481f32a6403SWarner Losh robert bassett for spotting this one and providing a fix. 482f32a6403SWarner Losh 483f32a6403SWarner Losh removed the files related to compilation on windows. i no 484f32a6403SWarner Losh longer have anything like a current windows environment, so 485f32a6403SWarner Losh i can't test any of it. 486f32a6403SWarner Losh 487f32a6403SWarner LoshMay 23, 2010: 488f32a6403SWarner Losh fixed long-standing overflow bug in run.c; many thanks to 489f32a6403SWarner Losh nelson beebe for spotting it and providing the fix. 490f32a6403SWarner Losh 491f32a6403SWarner Losh fixed bug that didn't parse -vd=1 properly; thanks to santiago 492f32a6403SWarner Losh vila for spotting it. 493f32a6403SWarner Losh 494f32a6403SWarner LoshFeb 8, 2010: 495f32a6403SWarner Losh i give up. replaced isblank with isspace in b.c; there are 496f32a6403SWarner Losh no consistent header files. 497f32a6403SWarner Losh 498f32a6403SWarner LoshNov 26, 2009: 499f32a6403SWarner Losh fixed a long-standing issue with when FS takes effect. a 500f32a6403SWarner Losh change to FS is now noticed immediately for subsequent splits. 501f32a6403SWarner Losh 502f32a6403SWarner Losh changed the name getline() to awkgetline() to avoid yet another 503f32a6403SWarner Losh name conflict somewhere. 504f32a6403SWarner Losh 505f32a6403SWarner LoshFeb 11, 2009: 506f32a6403SWarner Losh temporarily for now defined HAS_ISBLANK, since that seems to 507f32a6403SWarner Losh be the best way through the thicket. isblank arrived in C99, 508f32a6403SWarner Losh but seems to be arriving at different systems at different 509f32a6403SWarner Losh times. 510f32a6403SWarner Losh 511f32a6403SWarner LoshOct 8, 2008: 512f32a6403SWarner Losh fixed typo in b.c that set tmpvec wrongly. no one had ever 513f32a6403SWarner Losh run into the problem, apparently. thanks to alistair crooks. 514f32a6403SWarner Losh 515f32a6403SWarner LoshOct 23, 2007: 516f32a6403SWarner Losh minor fix in lib.c: increase inputFS to 100, change malloc 517f32a6403SWarner Losh for fields to n+1. 518f32a6403SWarner Losh 519f32a6403SWarner Losh fixed memory fault caused by out of order test in setsval. 520f32a6403SWarner Losh 521f32a6403SWarner Losh thanks to david o'brien, freebsd, for both fixes. 522f32a6403SWarner Losh 523f32a6403SWarner LoshMay 1, 2007: 524f32a6403SWarner Losh fiddle in makefile to fix for BSD make; thanks to igor sobrado. 525f32a6403SWarner Losh 526f32a6403SWarner LoshMar 31, 2007: 527f32a6403SWarner Losh fixed some null pointer refs calling adjbuf. 528f32a6403SWarner Losh 529f32a6403SWarner LoshFeb 21, 2007: 530f32a6403SWarner Losh fixed a bug in matching the null RE in sub and gsub. thanks to al aho 531f32a6403SWarner Losh who actually did the fix (in b.c), and to wolfgang seeberg for finding 532f32a6403SWarner Losh it and providing a very compact test case. 533f32a6403SWarner Losh 534f32a6403SWarner Losh fixed quotation in b.c; thanks to Hal Pratt and the Princeton Dante 535f32a6403SWarner Losh Project. 536f32a6403SWarner Losh 537f32a6403SWarner Losh removed some no-effect asserts in run.c. 538f32a6403SWarner Losh 539f32a6403SWarner Losh fiddled maketab.c to not complain about bison-generated values. 540f32a6403SWarner Losh 541f32a6403SWarner Losh removed the obsolete -V argument; fixed --version to print the 542f32a6403SWarner Losh version and exit. 543f32a6403SWarner Losh 544f32a6403SWarner Losh fixed wording and an outright error in the usage message; thanks to igor 545f32a6403SWarner Losh sobrado and jason mcintyre. 546f32a6403SWarner Losh 547f32a6403SWarner Losh fixed a bug in -d that caused core dump if no program followed. 548f32a6403SWarner Losh 549f32a6403SWarner LoshJan 1, 2007: 550f32a6403SWarner Losh dropped mac.code from makefile; there are few non-MacOSX 551f32a6403SWarner Losh mac's these days. 552f32a6403SWarner Losh 553f32a6403SWarner LoshJan 17, 2006: 554f32a6403SWarner Losh system() not flagged as unsafe in the unadvertised -safe option. 555f32a6403SWarner Losh found it while enhancing tests before shipping the ;login: article. 556f32a6403SWarner Losh practice what you preach. 557f32a6403SWarner Losh 558f32a6403SWarner Losh removed the 9-years-obsolete -mr and -mf flags. 559f32a6403SWarner Losh 560f32a6403SWarner Losh added -version and --version options. 561f32a6403SWarner Losh 562f32a6403SWarner Losh core dump on linux with BEGIN {nextfile}, now fixed. 563f32a6403SWarner Losh 564f32a6403SWarner Losh removed some #ifdef's in run.c and lex.c that appear to no 565f32a6403SWarner Losh longer be necessary. 566f32a6403SWarner Losh 567f32a6403SWarner LoshApr 24, 2005: 568f32a6403SWarner Losh modified lib.c so that values of $0 et al are preserved in the END 569f32a6403SWarner Losh block, apparently as required by posix. thanks to havard eidnes 570f32a6403SWarner Losh for the report and code. 571f32a6403SWarner Losh 572f32a6403SWarner LoshJan 14, 2005: 573f32a6403SWarner Losh fixed infinite loop in parsing, originally found by brian tsang. 574f32a6403SWarner Losh thanks to arnold robbins for a suggestion that started me 575f32a6403SWarner Losh rethinking it. 576f32a6403SWarner Losh 577f32a6403SWarner LoshDec 31, 2004: 578f32a6403SWarner Losh prevent overflow of -f array in main, head off potential error in 579f32a6403SWarner Losh call of SYNTAX(), test malloc return in lib.c, all with thanks to 580f32a6403SWarner Losh todd miller. 581f32a6403SWarner Losh 582f32a6403SWarner LoshDec 22, 2004: 583f32a6403SWarner Losh cranked up size of NCHARS; coverity thinks it can be overrun with 584f32a6403SWarner Losh smaller size, and i think that's right. added some assertions to b.c 585f32a6403SWarner Losh to catch places where it might overrun. the RE code is still fragile. 586f32a6403SWarner Losh 587f32a6403SWarner LoshDec 5, 2004: 588f32a6403SWarner Losh fixed a couple of overflow problems with ridiculous field numbers: 589f32a6403SWarner Losh e.g., print $(2^32-1). thanks to ruslan ermilov, giorgos keramidas 590f32a6403SWarner Losh and david o'brien at freebsd.org for patches. this really should 591f32a6403SWarner Losh be re-done from scratch. 592f32a6403SWarner Losh 593f32a6403SWarner LoshNov 21, 2004: 594f32a6403SWarner Losh fixed another 25-year-old RE bug, in split. it's another failure 595f32a6403SWarner Losh to (re-)initialize. thanks to steve fisher for spotting this and 596f32a6403SWarner Losh providing a good test case. 597f32a6403SWarner Losh 598f32a6403SWarner LoshNov 22, 2003: 599f32a6403SWarner Losh fixed a bug in regular expressions that dates (so help me) from 1977; 600f32a6403SWarner Losh it's been there from the beginning. an anchored longest match that 601f32a6403SWarner Losh was longer than the number of states triggered a failure to initialize 602f32a6403SWarner Losh the machine properly. many thanks to moinak ghosh for not only finding 603f32a6403SWarner Losh this one but for providing a fix, in some of the most mysterious 604f32a6403SWarner Losh code known to man. 605f32a6403SWarner Losh 606f32a6403SWarner Losh fixed a storage leak in call() that appears to have been there since 607f32a6403SWarner Losh 1983 or so -- a function without an explicit return that assigns a 608f32a6403SWarner Losh string to a parameter leaked a Cell. thanks to moinak ghosh for 609f32a6403SWarner Losh spotting this very subtle one. 610f32a6403SWarner Losh 611f32a6403SWarner LoshJul 31, 2003: 612f32a6403SWarner Losh fixed, thanks to andrey chernov and ruslan ermilov, a bug in lex.c 613f32a6403SWarner Losh that mis-handled the character 255 in input. (it was being compared 614f32a6403SWarner Losh to EOF with a signed comparison.) 615f32a6403SWarner Losh 616f32a6403SWarner LoshJul 29, 2003: 617f32a6403SWarner Losh fixed (i think) the long-standing botch that included the beginning of 618f32a6403SWarner Losh line state ^ for RE's in the set of valid characters; this led to a 619f32a6403SWarner Losh variety of odd problems, including failure to properly match certain 620f32a6403SWarner Losh regular expressions in non-US locales. thanks to ruslan for keeping 621f32a6403SWarner Losh at this one. 622f32a6403SWarner Losh 623f32a6403SWarner LoshJul 28, 2003: 624f32a6403SWarner Losh n-th try at getting internationalization right, with thanks to volker 625f32a6403SWarner Losh kiefel, arnold robbins and ruslan ermilov for advice, though they 626f32a6403SWarner Losh should not be blamed for the outcome. according to posix, "." is the 627f32a6403SWarner Losh radix character in programs and command line arguments regardless of 628f32a6403SWarner Losh the locale; otherwise, the locale should prevail for input and output 629f32a6403SWarner Losh of numbers. so it's intended to work that way. 630f32a6403SWarner Losh 631f32a6403SWarner Losh i have rescinded the attempt to use strcoll in expanding shorthands in 632f32a6403SWarner Losh regular expressions (cclenter). its properties are much too 633f32a6403SWarner Losh surprising; for example [a-c] matches aAbBc in locale en_US but abBcC 634f32a6403SWarner Losh in locale fr_CA. i can see how this might arise by implementation 635f32a6403SWarner Losh but i cannot explain it to a human user. (this behavior can be seen 636f32a6403SWarner Losh in gawk as well; we're leaning on the same library.) 637f32a6403SWarner Losh 638f32a6403SWarner Losh the issue appears to be that strcoll is meant for sorting, where 639f32a6403SWarner Losh merging upper and lower case may make sense (though note that unix 640f32a6403SWarner Losh sort does not do this by default either). it is not appropriate 641f32a6403SWarner Losh for regular expressions, where the goal is to match specific 642f32a6403SWarner Losh patterns of characters. in any case, the notations [:lower:], etc., 643f32a6403SWarner Losh are available in awk, and they are more likely to work correctly in 644f32a6403SWarner Losh most locales. 645f32a6403SWarner Losh 646f32a6403SWarner Losh a moratorium is hereby declared on internationalization changes. 647f32a6403SWarner Losh i apologize to friends and colleagues in other parts of the world. 648f32a6403SWarner Losh i would truly like to get this "right", but i don't know what 649f32a6403SWarner Losh that is, and i do not want to keep making changes until it's clear. 650f32a6403SWarner Losh 651f32a6403SWarner LoshJul 4, 2003: 652f32a6403SWarner Losh fixed bug that permitted non-terminated RE, as in "awk /x". 653f32a6403SWarner Losh 654f32a6403SWarner LoshJun 1, 2003: 655f32a6403SWarner Losh subtle change to split: if source is empty, number of elems 656f32a6403SWarner Losh is always 0 and the array is not set. 657f32a6403SWarner Losh 658f32a6403SWarner LoshMar 21, 2003: 659f32a6403SWarner Losh added some parens to isblank, in another attempt to make things 660f32a6403SWarner Losh internationally portable. 661f32a6403SWarner Losh 662f32a6403SWarner LoshMar 14, 2003: 663f32a6403SWarner Losh the internationalization changes, somewhat modified, are now 664f32a6403SWarner Losh reinstated. in theory awk will now do character comparisons 665f32a6403SWarner Losh and case conversions in national language, but "." will always 666f32a6403SWarner Losh be the decimal point separator on input and output regardless 667f32a6403SWarner Losh of national language. isblank(){} has an #ifndef. 668f32a6403SWarner Losh 669f32a6403SWarner Losh this no longer compiles on windows: LC_MESSAGES isn't defined 670f32a6403SWarner Losh in vc6++. 671f32a6403SWarner Losh 672f32a6403SWarner Losh fixed subtle behavior in field and record splitting: if FS is 673f32a6403SWarner Losh a single character and RS is not empty, \n is NOT a separator. 674f32a6403SWarner Losh this tortuous reading is found in the awk book; behavior now 675f32a6403SWarner Losh matches gawk and mawk. 676f32a6403SWarner Losh 677f32a6403SWarner LoshDec 13, 2002: 678f32a6403SWarner Losh for the moment, the internationalization changes of nov 29 are 679f32a6403SWarner Losh rolled back -- programs like x = 1.2 don't work in some locales, 680f32a6403SWarner Losh because the parser is expecting x = 1,2. until i understand this 681f32a6403SWarner Losh better, this will have to wait. 682f32a6403SWarner Losh 683f32a6403SWarner LoshNov 29, 2002: 684f32a6403SWarner Losh modified b.c (with tiny changes in main and run) to support 685f32a6403SWarner Losh locales, using strcoll and iswhatever tests for posix character 686f32a6403SWarner Losh classes. thanks to ruslan ermilov (ru@freebsd.org) for code. 687f32a6403SWarner Losh the function isblank doesn't seem to have propagated to any 688f32a6403SWarner Losh header file near me, so it's there explicitly. not properly 689f32a6403SWarner Losh tested on non-ascii character sets by me. 690f32a6403SWarner Losh 691f32a6403SWarner LoshJun 28, 2002: 692f32a6403SWarner Losh modified run/format() and tran/getsval() to do a slightly better 693f32a6403SWarner Losh job on using OFMT for output from print and CONVFMT for other 694f32a6403SWarner Losh number->string conversions, as promised by posix and done by 695f32a6403SWarner Losh gawk and mawk. there are still places where it doesn't work 696f32a6403SWarner Losh right if CONVFMT is changed; by then the STR attribute of the 697f32a6403SWarner Losh variable has been irrevocably set. thanks to arnold robbins for 698f32a6403SWarner Losh code and examples. 699f32a6403SWarner Losh 700f32a6403SWarner Losh fixed subtle bug in format that could get core dump. thanks to 701f32a6403SWarner Losh Jaromir Dolecek <jdolecek@NetBSD.org> for finding and fixing. 702f32a6403SWarner Losh minor cleanup in run.c / format() at the same time. 703f32a6403SWarner Losh 704f32a6403SWarner Losh added some tests for null pointers to debugging printf's, which 705f32a6403SWarner Losh were never intended for external consumption. thanks to dave 706f32a6403SWarner Losh kerns (dkerns@lucent.com) for pointing this out. 707f32a6403SWarner Losh 708f32a6403SWarner Losh GNU compatibility: an empty regexp matches anything (thanks to 709f32a6403SWarner Losh dag-erling smorgrav, des@ofug.org). subject to reversion if 710f32a6403SWarner Losh this does more harm than good. 711f32a6403SWarner Losh 712f32a6403SWarner Losh pervasive small changes to make things more const-correct, as 713f32a6403SWarner Losh reported by gcc's -Wwrite-strings. as it says in the gcc manual, 714f32a6403SWarner Losh this may be more nuisance than useful. provoked by a suggestion 715f32a6403SWarner Losh and code from arnaud desitter, arnaud@nimbus.geog.ox.ac.uk 716f32a6403SWarner Losh 717f32a6403SWarner Losh minor documentation changes to note that this now compiles out 718f32a6403SWarner Losh of the box on Mac OS X. 719f32a6403SWarner Losh 720f32a6403SWarner LoshFeb 10, 2002: 721f32a6403SWarner Losh changed types in posix chars structure to quiet solaris cc. 722f32a6403SWarner Losh 723f32a6403SWarner LoshJan 1, 2002: 724f32a6403SWarner Losh fflush() or fflush("") flushes all files and pipes. 725f32a6403SWarner Losh 726f32a6403SWarner Losh length(arrayname) returns number of elements; thanks to 727f32a6403SWarner Losh arnold robbins for suggestion. 728f32a6403SWarner Losh 729f32a6403SWarner Losh added a makefile.win to make it easier to build on windows. 730f32a6403SWarner Losh based on dan allen's buildwin.bat. 731f32a6403SWarner Losh 732f32a6403SWarner LoshNov 16, 2001: 733f32a6403SWarner Losh added support for posix character class names like [:digit:], 734f32a6403SWarner Losh which are not exactly shorter than [0-9] and perhaps no more 735f32a6403SWarner Losh portable. thanks to dag-erling smorgrav for code. 736f32a6403SWarner Losh 737f32a6403SWarner LoshFeb 16, 2001: 738f32a6403SWarner Losh removed -m option; no longer needed, and it was actually 739f32a6403SWarner Losh broken (noted thanks to volker kiefel). 740f32a6403SWarner Losh 741f32a6403SWarner LoshFeb 10, 2001: 742f32a6403SWarner Losh fixed an appalling bug in gettok: any sequence of digits, +,-, E, e, 743f32a6403SWarner Losh and period was accepted as a valid number if it started with a period. 744f32a6403SWarner Losh this would never have happened with the lex version. 745f32a6403SWarner Losh 746f32a6403SWarner Losh other 1-character botches, now fixed, include a bare $ and a 747f32a6403SWarner Losh bare " at the end of the input. 748f32a6403SWarner Losh 749f32a6403SWarner LoshFeb 7, 2001: 750f32a6403SWarner Losh more (const char *) casts in b.c and tran.c to silence warnings. 751f32a6403SWarner Losh 752f32a6403SWarner LoshNov 15, 2000: 753f32a6403SWarner Losh fixed a bug introduced in august 1997 that caused expressions 754f32a6403SWarner Losh like $f[1] to be syntax errors. thanks to arnold robbins for 755f32a6403SWarner Losh noticing this and providing a fix. 756f32a6403SWarner Losh 757f32a6403SWarner LoshOct 30, 2000: 758f32a6403SWarner Losh fixed some nextfile bugs: not handling all cases. thanks to 759f32a6403SWarner Losh arnold robbins for pointing this out. new regressions added. 760f32a6403SWarner Losh 761f32a6403SWarner Losh close() is now a function. it returns whatever the library 762f32a6403SWarner Losh fclose returns, and -1 for closing a file or pipe that wasn't 763f32a6403SWarner Losh opened. 764f32a6403SWarner Losh 765f32a6403SWarner LoshSep 24, 2000: 766f32a6403SWarner Losh permit \n explicitly in character classes; won't work right 767f32a6403SWarner Losh if comes in as "[\n]" but ok as /[\n]/, because of multiple 768f32a6403SWarner Losh processing of \'s. thanks to arnold robbins. 769f32a6403SWarner Losh 770f32a6403SWarner LoshJuly 5, 2000: 771f32a6403SWarner Losh minor fiddles in tran.c to keep compilers happy about uschar. 772f32a6403SWarner Losh thanks to norman wilson. 773f32a6403SWarner Losh 774f32a6403SWarner LoshMay 25, 2000: 775f32a6403SWarner Losh yet another attempt at making 8-bit input work, with another 776f32a6403SWarner Losh band-aid in b.c (member()), and some (uschar) casts to head 777f32a6403SWarner Losh off potential errors in subscripts (like isdigit). also 778f32a6403SWarner Losh changed HAT to NCHARS-2. thanks again to santiago vila. 779f32a6403SWarner Losh 780f32a6403SWarner Losh changed maketab.c to ignore apparently out of range definitions 781f32a6403SWarner Losh instead of halting; new freeBSD generates one. thanks to 782f32a6403SWarner Losh jon snader <jsnader@ix.netcom.com> for pointing out the problem. 783f32a6403SWarner Losh 784f32a6403SWarner LoshMay 2, 2000: 785f32a6403SWarner Losh fixed an 8-bit problem in b.c by making several char*'s into 786f32a6403SWarner Losh unsigned char*'s. not clear i have them all yet. thanks to 787f32a6403SWarner Losh Santiago Vila <sanvila@unex.es> for the bug report. 788f32a6403SWarner Losh 789f32a6403SWarner LoshApr 21, 2000: 790f32a6403SWarner Losh finally found and fixed a memory leak in function call; it's 791f32a6403SWarner Losh been there since functions were added ~1983. thanks to 792f32a6403SWarner Losh jon bentley for the test case that found it. 793f32a6403SWarner Losh 794f32a6403SWarner Losh added test in envinit to catch environment "variables" with 795f32a6403SWarner Losh names beginning with '='; thanks to Berend Hasselman. 796f32a6403SWarner Losh 797f32a6403SWarner LoshJul 28, 1999: 798f32a6403SWarner Losh added test in defn() to catch function foo(foo), which 799f32a6403SWarner Losh otherwise recurses until core dump. thanks to arnold 800f32a6403SWarner Losh robbins for noticing this. 801f32a6403SWarner Losh 802f32a6403SWarner LoshJun 20, 1999: 803f32a6403SWarner Losh added *bp in gettok in lex.c; appears possible to exit function 804f32a6403SWarner Losh without terminating the string. thanks to russ cox. 805f32a6403SWarner Losh 806f32a6403SWarner LoshJun 2, 1999: 807f32a6403SWarner Losh added function stdinit() to run to initialize files[] array, 808f32a6403SWarner Losh in case stdin, etc., are not constants; some compilers care. 809f32a6403SWarner Losh 810f32a6403SWarner LoshMay 10, 1999: 811f32a6403SWarner Losh replaced the ERROR ... FATAL, etc., macros with functions 812f32a6403SWarner Losh based on vprintf, to avoid problems caused by overrunning 813f32a6403SWarner Losh fixed-size errbuf array. thanks to ralph corderoy for the 814f32a6403SWarner Losh impetus, and for pointing out a string termination bug in 815f32a6403SWarner Losh qstring as well. 816f32a6403SWarner Losh 817f32a6403SWarner LoshApr 21, 1999: 818f32a6403SWarner Losh fixed bug that caused occasional core dumps with commandline 819f32a6403SWarner Losh variable with value ending in \. (thanks to nelson beebe for 820f32a6403SWarner Losh the test case.) 821f32a6403SWarner Losh 822f32a6403SWarner LoshApr 16, 1999: 823f32a6403SWarner Losh with code kindly provided by Bruce Lilly, awk now parses 824f32a6403SWarner Losh /=/ and similar constructs more sensibly in more places. 825f32a6403SWarner Losh Bruce also provided some helpful test cases. 826f32a6403SWarner Losh 827f32a6403SWarner LoshApr 5, 1999: 828f32a6403SWarner Losh changed true/false to True/False in run.c to make it 829f32a6403SWarner Losh easier to compile with C++. Added some casts on malloc 830f32a6403SWarner Losh and realloc to be honest about casts; ditto. changed 831f32a6403SWarner Losh ltype int to long in struct rrow to reduce some 64-bit 832f32a6403SWarner Losh complaints; other changes scattered throughout for the 833f32a6403SWarner Losh same purpose. thanks to Nelson Beebe for these portability 834f32a6403SWarner Losh improvements. 835f32a6403SWarner Losh 836f32a6403SWarner Losh removed some horrible pointer-int casting in b.c and elsewhere 837f32a6403SWarner Losh by adding ptoi and itonp to localize the casts, which are 838f32a6403SWarner Losh all benign. fixed one incipient bug that showed up on sgi 839f32a6403SWarner Losh in 64-bit mode. 840f32a6403SWarner Losh 841f32a6403SWarner Losh reset lineno for new source file; include filename in error 842f32a6403SWarner Losh message. also fixed line number error in continuation lines. 843f32a6403SWarner Losh (thanks to Nelson Beebe for both of these.) 844f32a6403SWarner Losh 845f32a6403SWarner LoshMar 24, 1999: 846f32a6403SWarner Losh Nelson Beebe notes that irix 5.3 yacc dies with a bogus 847f32a6403SWarner Losh error; use a newer version or switch to bison, since sgi 848f32a6403SWarner Losh is unlikely to fix it. 849f32a6403SWarner Losh 850f32a6403SWarner LoshMar 5, 1999: 851f32a6403SWarner Losh changed isnumber to is_number to avoid the problem caused by 852f32a6403SWarner Losh versions of ctype.h that include the name isnumber. 853f32a6403SWarner Losh 854f32a6403SWarner Losh distribution now includes a script for building on a Mac, 855f32a6403SWarner Losh thanks to Dan Allen. 856f32a6403SWarner Losh 857f32a6403SWarner LoshFeb 20, 1999: 858f32a6403SWarner Losh fixed memory leaks in run.c (call) and tran.c (setfval). 859f32a6403SWarner Losh thanks to Stephen Nutt for finding these and providing the fixes. 860f32a6403SWarner Losh 861f32a6403SWarner LoshJan 13, 1999: 862f32a6403SWarner Losh replaced srand argument by (unsigned int) in run.c; 863f32a6403SWarner Losh avoids problem on Mac and potentially on Unix & Windows. 864f32a6403SWarner Losh thanks to Dan Allen. 865f32a6403SWarner Losh 866f32a6403SWarner Losh added a few (int) casts to silence useless compiler warnings. 867f32a6403SWarner Losh e.g., errorflag= in run.c jump(). 868f32a6403SWarner Losh 869*17853db4SWarner Losh added proctab.c to the bundle output; one less thing 870f32a6403SWarner Losh to have to compile out of the box. 871f32a6403SWarner Losh 872f32a6403SWarner Losh added calls to _popen and _pclose to the win95 stub for 873f32a6403SWarner Losh pipes (thanks to Steve Adams for this helpful suggestion). 874f32a6403SWarner Losh seems to work, though properties are not well understood 875f32a6403SWarner Losh by me, and it appears that under some circumstances the 876f32a6403SWarner Losh pipe output is truncated. Be careful. 877f32a6403SWarner Losh 878f32a6403SWarner LoshOct 19, 1998: 879f32a6403SWarner Losh fixed a couple of bugs in getrec: could fail to update $0 880f32a6403SWarner Losh after a getline var; because inputFS wasn't initialized, 881f32a6403SWarner Losh could split $0 on every character, a misleading diversion. 882f32a6403SWarner Losh 883f32a6403SWarner Losh fixed caching bug in makedfa: LRU was actually removing 884f32a6403SWarner Losh least often used. 885f32a6403SWarner Losh 886f32a6403SWarner Losh thanks to ross ridge for finding these, and for providing 887f32a6403SWarner Losh great bug reports. 888f32a6403SWarner Losh 889f32a6403SWarner LoshMay 12, 1998: 890f32a6403SWarner Losh fixed potential bug in readrec: might fail to update record 891f32a6403SWarner Losh pointer after growing. thanks to dan levy for spotting this 892f32a6403SWarner Losh and suggesting the fix. 893f32a6403SWarner Losh 894f32a6403SWarner LoshMar 12, 1998: 895f32a6403SWarner Losh added -V to print version number and die. 896f32a6403SWarner Losh 897f32a6403SWarner Losh[notify dave kerns, dkerns@dacsoup.ih.lucent.com] 898f32a6403SWarner Losh 899f32a6403SWarner LoshFeb 11, 1998: 900f32a6403SWarner Losh subtle silent bug in lex.c: if the program ended with a number 901f32a6403SWarner Losh longer than 1 digit, part of the input would be pushed back and 902f32a6403SWarner Losh parsed again because token buffer wasn't terminated right. 903f32a6403SWarner Losh example: awk 'length($0) > 10'. blush. at least i found it 904f32a6403SWarner Losh myself. 905f32a6403SWarner Losh 906f32a6403SWarner LoshAug 31, 1997: 907f32a6403SWarner Losh s/adelete/awkdelete/: SGI uses this in malloc.h. 908f32a6403SWarner Losh thanks to nelson beebe for pointing this one out. 909f32a6403SWarner Losh 910f32a6403SWarner LoshAug 21, 1997: 911f32a6403SWarner Losh fixed some bugs in sub and gsub when replacement includes \\. 912f32a6403SWarner Losh this is a dark, horrible corner, but at least now i believe that 913f32a6403SWarner Losh the behavior is the same as gawk and the intended posix standard. 914f32a6403SWarner Losh thanks to arnold robbins for advice here. 915f32a6403SWarner Losh 916f32a6403SWarner LoshAug 9, 1997: 917f32a6403SWarner Losh somewhat regretfully, replaced the ancient lex-based lexical 918f32a6403SWarner Losh analyzer with one written in C. it's longer, generates less code, 919f32a6403SWarner Losh and more portable; the old one depended too much on mysterious 920f32a6403SWarner Losh properties of lex that were not preserved in other environments. 921f32a6403SWarner Losh in theory these recognize the same language. 922f32a6403SWarner Losh 923f32a6403SWarner Losh now using strtod to test whether a string is a number, instead of 924f32a6403SWarner Losh the convoluted original function. should be more portable and 925f32a6403SWarner Losh reliable if strtod is implemented right. 926f32a6403SWarner Losh 927f32a6403SWarner Losh removed now-pointless optimization in makefile that tries to avoid 928f32a6403SWarner Losh recompilation when awkgram.y is changed but symbols are not. 929f32a6403SWarner Losh 930f32a6403SWarner Losh removed most fixed-size arrays, though a handful remain, some 931f32a6403SWarner Losh of which are unchecked. you have been warned. 932f32a6403SWarner Losh 933f32a6403SWarner LoshAug 4, 1997: 934f32a6403SWarner Losh with some trepidation, replaced the ancient code that managed 935f32a6403SWarner Losh fields and $0 in fixed-size arrays with arrays that grow on 936f32a6403SWarner Losh demand. there is still some tension between trying to make this 937f32a6403SWarner Losh run fast and making it clean; not sure it's right yet. 938f32a6403SWarner Losh 939f32a6403SWarner Losh the ill-conceived -mr and -mf arguments are now useful only 940f32a6403SWarner Losh for debugging. previous dynamic string code removed. 941f32a6403SWarner Losh 942f32a6403SWarner Losh numerous other minor cleanups along the way. 943f32a6403SWarner Losh 944f32a6403SWarner LoshJul 30, 1997: 945f32a6403SWarner Losh using code provided by dan levy (to whom profuse thanks), replaced 946f32a6403SWarner Losh fixed-size arrays and awkward kludges by a fairly uniform mechanism 947f32a6403SWarner Losh to grow arrays as needed for printf, sub, gsub, etc. 948f32a6403SWarner Losh 949f32a6403SWarner LoshJul 23, 1997: 950f32a6403SWarner Losh falling off the end of a function returns "" and 0, not 0. 951f32a6403SWarner Losh thanks to arnold robbins. 952f32a6403SWarner Losh 953f32a6403SWarner LoshJun 17, 1997: 954f32a6403SWarner Losh replaced several fixed-size arrays by dynamically-created ones 955f32a6403SWarner Losh in run.c; added overflow tests to some previously unchecked cases. 956f32a6403SWarner Losh getline, toupper, tolower. 957f32a6403SWarner Losh 958f32a6403SWarner Losh getline code is still broken in that recursive calls may wind 959f32a6403SWarner Losh up using the same space. [fixed later] 960f32a6403SWarner Losh 961f32a6403SWarner Losh increased RECSIZE to 8192 to push problems further over the horizon. 962f32a6403SWarner Losh 963f32a6403SWarner Losh added \r to \n as input line separator for programs, not data. 964f32a6403SWarner Losh damn CRLFs. 965f32a6403SWarner Losh 966f32a6403SWarner Losh modified format() to permit explicit printf("%c", 0) to include 967f32a6403SWarner Losh a null byte in output. thanks to ken stailey for the fix. 968f32a6403SWarner Losh 969f32a6403SWarner Losh added a "-safe" argument that disables file output (print >, 970f32a6403SWarner Losh print >>), process creation (cmd|getline, print |, system), and 971f32a6403SWarner Losh access to the environment (ENVIRON). this is a first approximation 972f32a6403SWarner Losh to a "safe" version of awk, but don't rely on it too much. thanks 973f32a6403SWarner Losh to joan feigenbaum and matt blaze for the inspiration long ago. 974f32a6403SWarner Losh 975f32a6403SWarner LoshJul 8, 1996: 976f32a6403SWarner Losh fixed long-standing bug in sub, gsub(/a/, "\\\\&"); thanks to 977f32a6403SWarner Losh ralph corderoy. 978f32a6403SWarner Losh 979f32a6403SWarner LoshJun 29, 1996: 980f32a6403SWarner Losh fixed awful bug in new field splitting; didn't get all the places 981f32a6403SWarner Losh where input was done. 982f32a6403SWarner Losh 983f32a6403SWarner LoshJun 28, 1996: 984f32a6403SWarner Losh changed field-splitting to conform to posix definition: fields are 985f32a6403SWarner Losh split using the value of FS at the time of input; it used to be 986f32a6403SWarner Losh the value when the field or NF was first referred to, a much less 987f32a6403SWarner Losh predictable definition. thanks to arnold robbins for encouragement 988f32a6403SWarner Losh to do the right thing. 989f32a6403SWarner Losh 990f32a6403SWarner LoshMay 28, 1996: 991f32a6403SWarner Losh fixed appalling but apparently unimportant bug in parsing octal 992f32a6403SWarner Losh numbers in reg exprs. 993f32a6403SWarner Losh 994f32a6403SWarner Losh explicit hex in reg exprs now limited to 2 chars: \xa, \xaa. 995f32a6403SWarner Losh 996f32a6403SWarner LoshMay 27, 1996: 997f32a6403SWarner Losh cleaned up some declarations so gcc -Wall is now almost silent. 998f32a6403SWarner Losh 999f32a6403SWarner Losh makefile now includes backup copies of ytab.c and lexyy.c in case 1000f32a6403SWarner Losh one makes before looking; it also avoids recreating lexyy.c unless 1001f32a6403SWarner Losh really needed. 1002f32a6403SWarner Losh 1003f32a6403SWarner Losh s/aprintf/awkprint, s/asprintf/awksprintf/ to avoid some name clashes 1004f32a6403SWarner Losh with unwisely-written header files. 1005f32a6403SWarner Losh 1006f32a6403SWarner Losh thanks to jeffrey friedl for several of these. 1007f32a6403SWarner Losh 1008f32a6403SWarner LoshMay 26, 1996: 1009f32a6403SWarner Losh an attempt to rationalize the (unsigned) char issue. almost all 1010f32a6403SWarner Losh instances of unsigned char have been removed; the handful of places 1011f32a6403SWarner Losh in b.c where chars are used as table indices have been hand-crafted. 1012f32a6403SWarner Losh added some latin-1 tests to the regression, but i'm not confident; 1013f32a6403SWarner Losh none of my compilers seem to care much. thanks to nelson beebe for 1014f32a6403SWarner Losh pointing out some others that do care. 1015f32a6403SWarner Losh 1016f32a6403SWarner LoshMay 2, 1996: 1017f32a6403SWarner Losh removed all register declarations. 1018f32a6403SWarner Losh 1019f32a6403SWarner Losh enhanced split(), as in gawk, etc: split(s, a, "") splits s into 1020f32a6403SWarner Losh a[1]...a[length(s)] with each character a single element. 1021f32a6403SWarner Losh 1022f32a6403SWarner Losh made the same changes for field-splitting if FS is "". 1023f32a6403SWarner Losh 1024f32a6403SWarner Losh added nextfile, as in gawk: causes immediate advance to next 1025f32a6403SWarner Losh input file. (thanks to arnold robbins for inspiration and code). 1026f32a6403SWarner Losh 1027f32a6403SWarner Losh small fixes to regexpr code: can now handle []], [[], and 1028f32a6403SWarner Losh variants; [] is now a syntax error, rather than matching 1029f32a6403SWarner Losh everything; [z-a] is now empty, not z. far from complete 1030f32a6403SWarner Losh or correct, however. (thanks to jeffrey friedl for pointing out 1031f32a6403SWarner Losh some awful behaviors.) 1032f32a6403SWarner Losh 1033f32a6403SWarner LoshApr 29, 1996: 1034f32a6403SWarner Losh replaced uchar by uschar everywhere; apparently some compilers 1035f32a6403SWarner Losh usurp this name and this causes conflicts. 1036f32a6403SWarner Losh 1037f32a6403SWarner Losh fixed call to time in run.c (bltin); arg is time_t *. 1038f32a6403SWarner Losh 1039f32a6403SWarner Losh replaced horrible pointer/long punning in b.c by a legitimate 1040f32a6403SWarner Losh union. should be safer on 64-bit machines and cleaner everywhere. 1041f32a6403SWarner Losh (thanks to nelson beebe for pointing out some of these problems.) 1042f32a6403SWarner Losh 1043f32a6403SWarner Losh replaced nested comments by #if 0...#endif in run.c, lib.c. 1044f32a6403SWarner Losh 1045f32a6403SWarner Losh removed getsval, setsval, execute macros from run.c and lib.c. 1046f32a6403SWarner Losh machines are 100x faster than they were when these macros were 1047f32a6403SWarner Losh first used. 1048f32a6403SWarner Losh 1049f32a6403SWarner Losh revised filenames: awk.g.y => awkgram.y, awk.lx.l => awklex.l, 1050f32a6403SWarner Losh y.tab.[ch] => ytab.[ch], lex.yy.c => lexyy.c, all in the aid of 1051f32a6403SWarner Losh portability to nameless systems. 1052f32a6403SWarner Losh 1053f32a6403SWarner Losh "make bundle" now includes yacc and lex output files for recipients 1054f32a6403SWarner Losh who don't have yacc or lex. 1055f32a6403SWarner Losh 1056f32a6403SWarner LoshAug 15, 1995: 1057f32a6403SWarner Losh initialized Cells in setsymtab more carefully; some fields 1058f32a6403SWarner Losh were not set. (thanks to purify, all of whose complaints i 1059f32a6403SWarner Losh think i now understand.) 1060f32a6403SWarner Losh 1061f32a6403SWarner Losh fixed at least one error in gsub that looked at -1-th element 1062f32a6403SWarner Losh of an array when substituting for a null match (e.g., $). 1063f32a6403SWarner Losh 1064f32a6403SWarner Losh delete arrayname is now legal; it clears the elements but leaves 1065f32a6403SWarner Losh the array, which may not be the right behavior. 1066f32a6403SWarner Losh 1067f32a6403SWarner Losh modified makefile: my current make can't cope with the test used 1068f32a6403SWarner Losh to avoid unnecessary yacc invocations. 1069f32a6403SWarner Losh 1070f32a6403SWarner LoshJul 17, 1995: 1071f32a6403SWarner Losh added dynamically growing strings to awk.lx.l and b.c 1072f32a6403SWarner Losh to permit regular expressions to be much bigger. 1073f32a6403SWarner Losh the state arrays can still overflow. 1074f32a6403SWarner Losh 1075f32a6403SWarner LoshAug 24, 1994: 1076f32a6403SWarner Losh detect duplicate arguments in function definitions (mdm). 1077f32a6403SWarner Losh 1078f32a6403SWarner LoshMay 11, 1994: 1079f32a6403SWarner Losh trivial fix to printf to limit string size in sub(). 1080f32a6403SWarner Losh 1081f32a6403SWarner LoshApr 22, 1994: 1082f32a6403SWarner Losh fixed yet another subtle self-assignment problem: 1083f32a6403SWarner Losh $1 = $2; $1 = $1 clobbered $1. 1084f32a6403SWarner Losh 1085f32a6403SWarner Losh Regression tests now use private echo, to avoid quoting problems. 1086f32a6403SWarner Losh 1087f32a6403SWarner LoshFeb 2, 1994: 1088f32a6403SWarner Losh changed error() to print line number as %d, not %g. 1089f32a6403SWarner Losh 1090f32a6403SWarner LoshJul 23, 1993: 1091f32a6403SWarner Losh cosmetic changes: increased sizes of some arrays, 1092f32a6403SWarner Losh reworded some error messages. 1093f32a6403SWarner Losh 1094f32a6403SWarner Losh added CONVFMT as in posix (just replaced OFMT in getsval) 1095f32a6403SWarner Losh 1096f32a6403SWarner Losh FILENAME is now "" until the first thing that causes a file 1097f32a6403SWarner Losh to be opened. 1098f32a6403SWarner Losh 1099f32a6403SWarner LoshNov 28, 1992: 1100f32a6403SWarner Losh deleted yyunput and yyoutput from proto.h; 1101f32a6403SWarner Losh different versions of lex give these different declarations. 1102f32a6403SWarner Losh 1103f32a6403SWarner LoshMay 31, 1992: 1104f32a6403SWarner Losh added -mr N and -mf N options: more record and fields. 1105f32a6403SWarner Losh these really ought to adjust automatically. 1106f32a6403SWarner Losh 1107f32a6403SWarner Losh cleaned up some error messages; "out of space" now means 1108f32a6403SWarner Losh malloc returned NULL in all cases. 1109f32a6403SWarner Losh 1110f32a6403SWarner Losh changed rehash so that if it runs out, it just returns; 1111f32a6403SWarner Losh things will continue to run slow, but maybe a bit longer. 1112f32a6403SWarner Losh 1113f32a6403SWarner LoshApr 24, 1992: 1114f32a6403SWarner Losh remove redundant close of stdin when using -f -. 1115f32a6403SWarner Losh 1116f32a6403SWarner Losh got rid of core dump with -d; awk -d just prints date. 1117f32a6403SWarner Losh 1118f32a6403SWarner LoshApr 12, 1992: 1119f32a6403SWarner Losh added explicit check for /dev/std(in,out,err) in redirection. 1120f32a6403SWarner Losh unlike gawk, no /dev/fd/n yet. 1121f32a6403SWarner Losh 1122f32a6403SWarner Losh added (file/pipe) builtin. hard to test satisfactorily. 1123f32a6403SWarner Losh not posix. 1124f32a6403SWarner Losh 1125f32a6403SWarner LoshFeb 20, 1992: 1126f32a6403SWarner Losh recompile after abortive changes; should be unchanged. 1127f32a6403SWarner Losh 1128f32a6403SWarner LoshDec 2, 1991: 1129f32a6403SWarner Losh die-casting time: converted to ansi C, installed that. 1130f32a6403SWarner Losh 1131f32a6403SWarner LoshNov 30, 1991: 1132f32a6403SWarner Losh fixed storage leak in freefa, failing to recover [N]CCL. 1133f32a6403SWarner Losh thanks to Bill Jones (jones@cs.usask.ca) 1134f32a6403SWarner Losh 1135f32a6403SWarner LoshNov 19, 1991: 1136f32a6403SWarner Losh use RAND_MAX instead of literal in builtin(). 1137f32a6403SWarner Losh 1138f32a6403SWarner LoshNov 12, 1991: 1139f32a6403SWarner Losh cranked up some fixed-size arrays in b.c, and added a test for 1140f32a6403SWarner Losh overflow in penter. thanks to mark larsen. 1141f32a6403SWarner Losh 1142f32a6403SWarner LoshSep 24, 1991: 1143f32a6403SWarner Losh increased buffer in gsub. a very crude fix to a general problem. 1144f32a6403SWarner Losh and again on Sep 26. 1145f32a6403SWarner Losh 1146f32a6403SWarner LoshAug 18, 1991: 1147f32a6403SWarner Losh enforce variable name syntax for commandline variables: has to 1148f32a6403SWarner Losh start with letter or _. 1149f32a6403SWarner Losh 1150f32a6403SWarner LoshJul 27, 1991: 1151f32a6403SWarner Losh allow newline after ; in for statements. 1152f32a6403SWarner Losh 1153f32a6403SWarner LoshJul 21, 1991: 1154f32a6403SWarner Losh fixed so that in self-assignment like $1=$1, side effects 1155f32a6403SWarner Losh like recomputing $0 take place. (this is getting subtle.) 1156f32a6403SWarner Losh 1157f32a6403SWarner LoshJun 30, 1991: 1158f32a6403SWarner Losh better test for detecting too-long output record. 1159f32a6403SWarner Losh 1160f32a6403SWarner LoshJun 2, 1991: 1161f32a6403SWarner Losh better defense against very long printf strings. 1162f32a6403SWarner Losh made break and continue illegal outside of loops. 1163f32a6403SWarner Losh 1164f32a6403SWarner LoshMay 13, 1991: 1165f32a6403SWarner Losh removed extra arg on gettemp, tempfree. minor error message rewording. 1166f32a6403SWarner Losh 1167f32a6403SWarner LoshMay 6, 1991: 1168f32a6403SWarner Losh fixed silly bug in hex parsing in hexstr(). 1169f32a6403SWarner Losh removed an apparently unnecessary test in isnumber(). 1170f32a6403SWarner Losh warn about weird printf conversions. 1171f32a6403SWarner Losh fixed unchecked array overwrite in relex(). 1172f32a6403SWarner Losh 1173f32a6403SWarner Losh changed for (i in array) to access elements in sorted order. 1174f32a6403SWarner Losh then unchanged it -- it really does run slower in too many cases. 1175f32a6403SWarner Losh left the code in place, commented out. 1176f32a6403SWarner Losh 1177f32a6403SWarner LoshFeb 10, 1991: 1178f32a6403SWarner Losh check error status on all writes, to avoid banging on full disks. 1179f32a6403SWarner Losh 1180f32a6403SWarner LoshJan 28, 1991: 1181f32a6403SWarner Losh awk -f - reads the program from stdin. 1182f32a6403SWarner Losh 1183f32a6403SWarner LoshJan 11, 1991: 1184f32a6403SWarner Losh failed to set numeric state on $0 in cmd|getline context in run.c. 1185f32a6403SWarner Losh 1186f32a6403SWarner LoshNov 2, 1990: 1187f32a6403SWarner Losh fixed sleazy test for integrality in getsval; use modf. 1188f32a6403SWarner Losh 1189f32a6403SWarner LoshOct 29, 1990: 1190f32a6403SWarner Losh fixed sleazy buggy code in lib.c that looked (incorrectly) for 1191f32a6403SWarner Losh too long input lines. 1192f32a6403SWarner Losh 1193f32a6403SWarner LoshOct 14, 1990: 1194f32a6403SWarner Losh fixed the bug on p. 198 in which it couldn't deduce that an 1195f32a6403SWarner Losh argument was an array in some contexts. replaced the error 1196f32a6403SWarner Losh message in intest() by code that damn well makes it an array. 1197f32a6403SWarner Losh 1198f32a6403SWarner LoshOct 8, 1990: 1199f32a6403SWarner Losh fixed horrible bug: types and values were not preserved in 1200f32a6403SWarner Losh some kinds of self-assignment. (in assign().) 1201f32a6403SWarner Losh 1202f32a6403SWarner LoshAug 24, 1990: 1203f32a6403SWarner Losh changed NCHARS to 256 to handle 8-bit characters in strings 1204f32a6403SWarner Losh presented to match(), etc. 1205f32a6403SWarner Losh 1206f32a6403SWarner LoshJun 26, 1990: 1207f32a6403SWarner Losh changed struct rrow (awk.h) to use long instead of int for lval, 1208f32a6403SWarner Losh since cfoll() stores a pointer in it. now works better when int's 1209f32a6403SWarner Losh are smaller than pointers! 1210f32a6403SWarner Losh 1211f32a6403SWarner LoshMay 6, 1990: 1212f32a6403SWarner Losh AVA fixed the grammar so that ! is uniformly of the same precedence as 1213f32a6403SWarner Losh unary + and -. This renders illegal some constructs like !x=y, which 1214f32a6403SWarner Losh now has to be parenthesized as !(x=y), and makes others work properly: 1215f32a6403SWarner Losh !x+y is (!x)+y, and x!y is x !y, not two pattern-action statements. 1216f32a6403SWarner Losh (These problems were pointed out by Bob Lenk of Posix.) 1217f32a6403SWarner Losh 1218f32a6403SWarner Losh Added \x to regular expressions (already in strings). 1219f32a6403SWarner Losh Limited octal to octal digits; \8 and \9 are not octal. 1220f32a6403SWarner Losh Centralized the code for parsing escapes in regular expressions. 1221f32a6403SWarner Losh Added a bunch of tests to T.re and T.sub to verify some of this. 1222f32a6403SWarner Losh 1223f32a6403SWarner LoshFeb 9, 1990: 1224f32a6403SWarner Losh fixed null pointer dereference bug in main.c: -F[nothing]. sigh. 1225f32a6403SWarner Losh 1226f32a6403SWarner Losh restored srand behavior: it returns the current seed. 1227f32a6403SWarner Losh 1228f32a6403SWarner LoshJan 18, 1990: 1229f32a6403SWarner Losh srand now returns previous seed value (0 to start). 1230f32a6403SWarner Losh 1231f32a6403SWarner LoshJan 5, 1990: 1232f32a6403SWarner Losh fix potential problem in tran.c -- something was freed, 1233f32a6403SWarner Losh then used in freesymtab. 1234f32a6403SWarner Losh 1235f32a6403SWarner LoshOct 18, 1989: 1236f32a6403SWarner Losh another try to get the max number of open files set with 1237f32a6403SWarner Losh relatively machine-independent code. 1238f32a6403SWarner Losh 1239f32a6403SWarner Losh small fix to input() in case of multiple reads after EOF. 1240f32a6403SWarner Losh 1241f32a6403SWarner LoshOct 11, 1989: 1242f32a6403SWarner Losh FILENAME is now defined in the BEGIN block -- too many old 1243f32a6403SWarner Losh programs broke. 1244f32a6403SWarner Losh 1245f32a6403SWarner Losh "-" means stdin in getline as well as on the commandline. 1246f32a6403SWarner Losh 1247f32a6403SWarner Losh added a bunch of casts to the code to tell the truth about 1248f32a6403SWarner Losh char * vs. unsigned char *, a right royal pain. added a 1249f32a6403SWarner Losh setlocale call to the front of main, though probably no one 1250f32a6403SWarner Losh has it usefully implemented yet. 1251f32a6403SWarner Losh 1252f32a6403SWarner LoshAug 24, 1989: 1253f32a6403SWarner Losh removed redundant relational tests against nullnode if parse 1254f32a6403SWarner Losh tree already had a relational at that point. 1255f32a6403SWarner Losh 1256f32a6403SWarner LoshAug 11, 1989: 1257f32a6403SWarner Losh fixed bug: commandline variable assignment has to look like 1258f32a6403SWarner Losh var=something. (consider the man page for =, in file =.1) 1259f32a6403SWarner Losh 1260f32a6403SWarner Losh changed number of arguments to functions to static arrays 1261f32a6403SWarner Losh to avoid repeated malloc calls. 1262f32a6403SWarner Losh 1263f32a6403SWarner LoshAug 2, 1989: 1264f32a6403SWarner Losh restored -F (space) separator 1265f32a6403SWarner Losh 1266f32a6403SWarner LoshJul 30, 1989: 1267f32a6403SWarner Losh added -v x=1 y=2 ... for immediate commandline variable assignment; 1268f32a6403SWarner Losh done before the BEGIN block for sure. they have to precede the 1269f32a6403SWarner Losh program if the program is on the commandline. 1270f32a6403SWarner Losh Modified Aug 2 to require a separate -v for each assignment. 1271f32a6403SWarner Losh 1272f32a6403SWarner LoshJul 10, 1989: 1273f32a6403SWarner Losh fixed ref-thru-zero bug in environment code in tran.c 1274f32a6403SWarner Losh 1275f32a6403SWarner LoshJun 23, 1989: 1276f32a6403SWarner Losh add newline to usage message. 1277f32a6403SWarner Losh 1278f32a6403SWarner LoshJun 14, 1989: 1279f32a6403SWarner Losh added some missing ansi printf conversion letters: %i %X %E %G. 1280f32a6403SWarner Losh no sensible meaning for h or L, so they may not do what one expects. 1281f32a6403SWarner Losh 1282f32a6403SWarner Losh made %* conversions work. 1283f32a6403SWarner Losh 1284f32a6403SWarner Losh changed x^y so that if n is a positive integer, it's done 1285f32a6403SWarner Losh by explicit multiplication, thus achieving maximum accuracy. 1286f32a6403SWarner Losh (this should be done by pow() but it seems not to be locally.) 1287f32a6403SWarner Losh done to x ^= y as well. 1288f32a6403SWarner Losh 1289f32a6403SWarner LoshJun 4, 1989: 1290f32a6403SWarner Losh ENVIRON array contains environment: if shell variable V=thing, 1291f32a6403SWarner Losh ENVIRON["V"] is "thing" 1292f32a6403SWarner Losh 1293f32a6403SWarner Losh multiple -f arguments permitted. error reporting is naive. 1294f32a6403SWarner Losh (they were permitted before, but only the last was used.) 1295f32a6403SWarner Losh 1296f32a6403SWarner Losh fixed a really stupid botch in the debugging macro dprintf 1297f32a6403SWarner Losh 1298f32a6403SWarner Losh fixed order of evaluation of commandline assignments to match 1299f32a6403SWarner Losh what the book claims: an argument of the form x=e is evaluated 1300f32a6403SWarner Losh at the time it would have been opened if it were a filename (p 63). 1301f32a6403SWarner Losh this invalidates the suggested answer to ex 4-1 (p 195). 1302f32a6403SWarner Losh 1303f32a6403SWarner Losh removed some code that permitted -F (space) fieldseparator, 1304f32a6403SWarner Losh since it didn't quite work right anyway. (restored aug 2) 1305f32a6403SWarner Losh 1306f32a6403SWarner LoshApr 27, 1989: 1307f32a6403SWarner Losh Line number now accumulated correctly for comment lines. 1308f32a6403SWarner Losh 1309f32a6403SWarner LoshApr 26, 1989: 1310f32a6403SWarner Losh Debugging output now includes a version date, 1311f32a6403SWarner Losh if one compiles it into the source each time. 1312f32a6403SWarner Losh 1313f32a6403SWarner LoshApr 9, 1989: 1314f32a6403SWarner Losh Changed grammar to prohibit constants as 3rd arg of sub and gsub; 1315f32a6403SWarner Losh prevents class of overwriting-a-constant errors. (Last one?) 1316f32a6403SWarner Losh This invalidates the "banana" example on page 43 of the book. 1317f32a6403SWarner Losh 1318f32a6403SWarner Losh Added \a ("alert"), \v (vertical tab), \xhhh (hexadecimal), 1319f32a6403SWarner Losh as in ANSI, for strings. Rescinded the sloppiness that permitted 1320f32a6403SWarner Losh non-octal digits in \ooo. Warning: not all compilers and libraries 1321f32a6403SWarner Losh will be able to deal with \x correctly. 1322f32a6403SWarner Losh 1323f32a6403SWarner LoshJan 9, 1989: 1324f32a6403SWarner Losh Fixed bug that caused tempcell list to contain a duplicate. 1325f32a6403SWarner Losh The fix is kludgy. 1326f32a6403SWarner Losh 1327f32a6403SWarner LoshDec 17, 1988: 1328f32a6403SWarner Losh Catches some more commandline errors in main. 1329f32a6403SWarner Losh Removed redundant decl of modf in run.c (confuses some compilers). 1330f32a6403SWarner Losh Warning: there's no single declaration of malloc, etc., in awk.h 1331f32a6403SWarner Losh that seems to satisfy all compilers. 1332f32a6403SWarner Losh 1333f32a6403SWarner LoshDec 7, 1988: 1334f32a6403SWarner Losh Added a bit of code to error printing to avoid printing nulls. 1335f32a6403SWarner Losh (Not clear that it actually would.) 1336f32a6403SWarner Losh 1337f32a6403SWarner LoshNov 27, 1988: 1338f32a6403SWarner Losh With fear and trembling, modified the grammar to permit 1339f32a6403SWarner Losh multiple pattern-action statements on one line without 1340f32a6403SWarner Losh an explicit separator. By definition, this capitulation 1341f32a6403SWarner Losh to the ghost of ancient implementations remains undefined 1342f32a6403SWarner Losh and thus subject to change without notice or apology. 1343f32a6403SWarner Losh DO NOT COUNT ON IT. 1344f32a6403SWarner Losh 1345f32a6403SWarner LoshOct 30, 1988: 1346f32a6403SWarner Losh Fixed bug in call() that failed to recover storage. 1347f32a6403SWarner Losh 1348f32a6403SWarner Losh A warning is now generated if there are more arguments 1349f32a6403SWarner Losh in the call than in the definition (in lieu of fixing 1350f32a6403SWarner Losh another storage leak). 1351f32a6403SWarner Losh 1352f32a6403SWarner LoshOct 20, 1988: 1353f32a6403SWarner Losh Fixed %c: if expr is numeric, use numeric value; 1354f32a6403SWarner Losh otherwise print 1st char of string value. still 1355f32a6403SWarner Losh doesn't work if the value is 0 -- won't print \0. 1356f32a6403SWarner Losh 1357f32a6403SWarner Losh Added a few more checks for running out of malloc. 1358f32a6403SWarner Losh 1359f32a6403SWarner LoshOct 12, 1988: 1360f32a6403SWarner Losh Fixed bug in call() that freed local arrays twice. 1361f32a6403SWarner Losh 1362f32a6403SWarner Losh Fixed to handle deletion of non-existent array right; 1363f32a6403SWarner Losh complains about attempt to delete non-array element. 1364f32a6403SWarner Losh 1365f32a6403SWarner LoshSep 30, 1988: 1366f32a6403SWarner Losh Now guarantees to evaluate all arguments of built-in 1367f32a6403SWarner Losh functions, as in C; the appearance is that arguments 1368f32a6403SWarner Losh are evaluated before the function is called. Places 1369f32a6403SWarner Losh affected are sub (gsub was ok), substr, printf, and 1370f32a6403SWarner Losh all the built-in arithmetic functions in bltin(). 1371f32a6403SWarner Losh A warning is generated if a bltin() is called with 1372f32a6403SWarner Losh the wrong number of arguments. 1373f32a6403SWarner Losh 1374f32a6403SWarner Losh This requires changing makeprof on p167 of the book. 1375f32a6403SWarner Losh 1376f32a6403SWarner LoshAug 23, 1988: 1377f32a6403SWarner Losh setting FILENAME in BEGIN caused core dump, apparently 1378f32a6403SWarner Losh because it was freeing space not allocated by malloc. 1379f32a6403SWarner Losh 1380f32a6403SWarner LoshJuly 24, 1988: 1381f32a6403SWarner Losh fixed egregious error in toupper/tolower functions. 1382f32a6403SWarner Losh still subject to rescinding, however. 1383f32a6403SWarner Losh 1384f32a6403SWarner LoshJuly 2, 1988: 1385f32a6403SWarner Losh flush stdout before opening file or pipe 1386f32a6403SWarner Losh 1387f32a6403SWarner LoshJuly 2, 1988: 1388f32a6403SWarner Losh performance bug in b.c/cgoto(): not freeing some sets of states. 1389f32a6403SWarner Losh partial fix only right now, and the number of states increased 1390f32a6403SWarner Losh to make it less obvious. 1391f32a6403SWarner Losh 1392f32a6403SWarner LoshJune 1, 1988: 1393f32a6403SWarner Losh check error status on close 1394f32a6403SWarner Losh 1395f32a6403SWarner LoshMay 28, 1988: 1396f32a6403SWarner Losh srand returns seed value it's using. 1397f32a6403SWarner Losh see 1/18/90 1398f32a6403SWarner Losh 1399f32a6403SWarner LoshMay 22, 1988: 1400f32a6403SWarner Losh Removed limit on depth of function calls. 1401f32a6403SWarner Losh 1402f32a6403SWarner LoshMay 10, 1988: 1403f32a6403SWarner Losh Fixed lib.c to permit _ in commandline variable names. 1404f32a6403SWarner Losh 1405f32a6403SWarner LoshMar 25, 1988: 1406f32a6403SWarner Losh main.c fixed to recognize -- as terminator of command- 1407f32a6403SWarner Losh line options. Illegal options flagged. 1408f32a6403SWarner Losh Error reporting slightly cleaned up. 1409f32a6403SWarner Losh 1410f32a6403SWarner LoshDec 2, 1987: 1411f32a6403SWarner Losh Newer C compilers apply a strict scope rule to extern 1412f32a6403SWarner Losh declarations within functions. Two extern declarations in 1413f32a6403SWarner Losh lib.c and tran.c have been moved to obviate this problem. 1414f32a6403SWarner Losh 1415f32a6403SWarner LoshOct xx, 1987: 1416f32a6403SWarner Losh Reluctantly added toupper and tolower functions. 1417f32a6403SWarner Losh Subject to rescinding without notice. 1418f32a6403SWarner Losh 1419f32a6403SWarner LoshSep 17, 1987: 1420f32a6403SWarner Losh Error-message printer had printf(s) instead of 1421f32a6403SWarner Losh printf("%s",s); got core dumps when the message 1422f32a6403SWarner Losh included a %. 1423f32a6403SWarner Losh 1424f32a6403SWarner LoshSep 12, 1987: 1425f32a6403SWarner Losh Very long printf strings caused core dump; 1426f32a6403SWarner Losh fixed aprintf, asprintf, format to catch them. 1427f32a6403SWarner Losh Can still get a core dump in printf itself. 1428f32a6403SWarner Losh 1429f32a6403SWarner Losh 1430