1f39dd6a9SWarner Losh2020-07-30 Arnold D. Robbins <arnold@skeeve.com> 2f39dd6a9SWarner Losh 3f39dd6a9SWarner Losh By fiat, we use bison for $(YACC). Trying to accommodate 4f39dd6a9SWarner Losh different versions didn't work. 5f39dd6a9SWarner Losh 6f39dd6a9SWarner Losh * makefile: Significant cleanup. Replace all ytab* references 7f39dd6a9SWarner Losh with awkgram.tab.* and simplify definition of YACC. 8f39dd6a9SWarner Losh * .gitignore: Remove ytab* references. 9f39dd6a9SWarner Losh * b.c, lex.c, maketab.c, parse.c, run.c: Replace include of ytab.h 10f39dd6a9SWarner Losh with awkgram.tab.h. 11f39dd6a9SWarner Losh * lib.c, main.c, tran.c: Remove include of ytab.h, wasn't needed. 12f39dd6a9SWarner Losh 13f39dd6a9SWarner Losh2020-01-20 Arnold D. Robbins <arnold@skeeve.com> 14f39dd6a9SWarner Losh 15f39dd6a9SWarner Losh * run.c (openfile): Set the close-on-exec flag for file 16f39dd6a9SWarner Losh and pipe redirections that aren't stdin/stdout/stderr. 17f39dd6a9SWarner Losh 18f39dd6a9SWarner Losh2020-01-06 Arnold D. Robbins <arnold@skeeve.com> 19f39dd6a9SWarner Losh 20f39dd6a9SWarner Losh Minor fixes. 21f39dd6a9SWarner Losh * b.c (replace_repeat): Turn init_q back into an int. 22f39dd6a9SWarner Losh * lex.c (string): Use \a instead of \007. 23f39dd6a9SWarner Losh * tran.c (catstr): Use snprintf instead of sprintf. 24f39dd6a9SWarner Losh 25f39dd6a9SWarner Losh2020-01-01 Arnold D. Robbins <arnold@skeeve.com> 26f39dd6a9SWarner Losh 27f39dd6a9SWarner Losh * tran.c (syminit, arginit, envinit): Free sval member before 28f39dd6a9SWarner Losh setting it. Thanks to valgrind. 29f39dd6a9SWarner Losh * b.c: Small formatting cleanups in several routines. 30f39dd6a9SWarner Losh 31f39dd6a9SWarner Losh2019-12-27 Arnold D. Robbins <arnold@skeeve.com> 32f39dd6a9SWarner Losh 33f39dd6a9SWarner Losh * b.c (replace_repeat): Fix a bug whereby a{0,3} could match 34f39dd6a9SWarner Losh four a's. Thanks to Anonymous AWK fan <awkfan77@mailfence.com> 35f39dd6a9SWarner Losh for the report. Also, minor code formatting cleanups. 36f39dd6a9SWarner Losh * testdir/T.int-expr: New file. 37f39dd6a9SWarner Losh 38f39dd6a9SWarner Losh2019-12-11 Arnold D. Robbins <arnold@skeeve.com> 39f39dd6a9SWarner Losh 40f39dd6a9SWarner Losh * README: Renamed to ... 41f39dd6a9SWarner Losh * README.md: ... this. Cleaned up some as well, 42f39dd6a9SWarner Losh including moving to Markdown. 43f39dd6a9SWarner Losh 44f39dd6a9SWarner Losh2019-11-08 Arnold D. Robbins <arnold@skeeve.com> 45f39dd6a9SWarner Losh 46f39dd6a9SWarner Losh * test/T.chem: Use $oldawk instead of hardwiring 'awk'. 47f39dd6a9SWarner Losh * test/T.lilly: Remove gawk warnings from output, improves 48f39dd6a9SWarner Losh portability. 49f39dd6a9SWarner Losh 50*eb690a05SWarner Losh2019-10-17 Arnold D. Robbins <arnold@skeeve.com> 51*eb690a05SWarner Losh 52*eb690a05SWarner Losh Pull in systime() and strftime() from the NetBSD awk. 53*eb690a05SWarner Losh 54*eb690a05SWarner Losh * awk.1: Document the functions. 55*eb690a05SWarner Losh * run.c (bltin): Implement the functions. 56*eb690a05SWarner Losh * awk.h: Add defines for systime and strftime. 57*eb690a05SWarner Losh * lex.c: Add support for systime and strftime. 58*eb690a05SWarner Losh 59*eb690a05SWarner Losh2019-10-07 Arnold D. Robbins <arnold@skeeve.com> 60*eb690a05SWarner Losh 61*eb690a05SWarner Losh Integrate features from different *BSD versions of awk. 62*eb690a05SWarner Losh Gensub support from NetBSD. Bitwise functions from OpenBSD. 63*eb690a05SWarner Losh 64*eb690a05SWarner Losh * awk.h: Add defines for and, or, xor, compl, lshift and rshift. 65*eb690a05SWarner Losh * awkgram.y: Add support for gensub. 66*eb690a05SWarner Losh * maketab.c: Ditto. 67*eb690a05SWarner Losh * lex.c: Add support for gensub and bitwise functions. 68*eb690a05SWarner Losh * parse.c (node5, op5): New functions. 69*eb690a05SWarner Losh * proto.h (node5, op5): New declarations. 70*eb690a05SWarner Losh * run.c (bltin): Implement the bitwise functions. 71*eb690a05SWarner Losh (gensub): New function. 72*eb690a05SWarner Losh * awk.1: Document additional functions. 73*eb690a05SWarner Losh 74f39dd6a9SWarner Losh2019-10-07 Arnold D. Robbins <arnold@skeeve.com> 75f39dd6a9SWarner Losh 76f39dd6a9SWarner Losh * b.c (fnematch): Change type of pbuf from unsigned char to char. 77f39dd6a9SWarner Losh * proto.h (fnematch): Ditto. 78f39dd6a9SWarner Losh 79f39dd6a9SWarner Losh2019-10-06 Arnold D. Robbins <arnold@skeeve.com> 80f39dd6a9SWarner Losh 81f39dd6a9SWarner Losh * lib.c (readrec): Allow RS a regular expression. Imported 82f39dd6a9SWarner Losh the code from the NetBSD awk. 83f39dd6a9SWarner Losh * b.c (fnematch): New function for implementing the feature. 84f39dd6a9SWarner Losh * awk.1: Updated. 85f39dd6a9SWarner Losh * main.c (version): Updated. 86f39dd6a9SWarner Losh 87f39dd6a9SWarner Losh2019-06-24 Arnold D. Robbins <arnold@skeeve.com> 88f39dd6a9SWarner Losh 89f39dd6a9SWarner Losh * makefile: Revise to take into account there is no more awktest.tar, 90f39dd6a9SWarner Losh add targets 'check' and 'test', and also 'testclean' to clean up 91f39dd6a9SWarner Losh after test run. Have 'clean' and 'cleaner' depend upon 'testclean'. 92f39dd6a9SWarner Losh 93f39dd6a9SWarner Losh2019-06-23 Arnold D. Robbins <arnold@skeeve.com> 94f39dd6a9SWarner Losh 95f39dd6a9SWarner Losh * testdir: Extracted from awktest.tar and added to Git. 96f39dd6a9SWarner Losh * awktest.tar: Removed. 97f39dd6a9SWarner Losh 98f39dd6a9SWarner Losh2019-06-06 Arnold D. Robbins <arnold@skeeve.com> 99f39dd6a9SWarner Losh 100f39dd6a9SWarner Losh * awk.1: Fix a typo, minor edits. 101f39dd6a9SWarner Losh 102f39dd6a9SWarner Losh2019-06-05 Arnold D. Robbins <arnold@skeeve.com> 103f39dd6a9SWarner Losh 104f39dd6a9SWarner Losh * b.c (relex): Count parentheses and treat umatched right paren 105f39dd6a9SWarner Losh as a literal character. 106f39dd6a9SWarner Losh * awktest.tar (testdir/T.re): Added a test case. 107f39dd6a9SWarner Losh * main.c (version): Updated. 108f39dd6a9SWarner Losh 109b5253557SWarner Losh2019-05-29 Arnold D. Robbins <arnold@skeeve.com> 110b5253557SWarner Losh 111b5253557SWarner Losh * lib.c (isclvar): Remove check for additional '=' after 112b5253557SWarner Losh first one. No longer needed. 113b5253557SWarner Losh 114b5253557SWarner Losh2019-01-26 Arnold D. Robbins <arnold@skeeve.com> 115b5253557SWarner Losh 116b5253557SWarner Losh * main.c (version): Updated. 117b5253557SWarner Losh 118b5253557SWarner Losh2019-01-25 Arnold D. Robbins <arnold@skeeve.com> 119b5253557SWarner Losh 120b5253557SWarner Losh * run.c (awkgetline): Check for numeric value in all getline 121b5253557SWarner Losh variants. See the numeric-getline.* files in bugs-fixed directory. 122b5253557SWarner Losh 123b5253557SWarner Losh2018-08-29 Arnold D. Robbins <arnold@skeeve.com> 124b5253557SWarner Losh 125b5253557SWarner Losh * REGRESS: Check for existence of a.out. If not there, run 126b5253557SWarner Losh make. Enable core dumps for T.arnold system status test 127b5253557SWarner Losh to work on MacOS X. 128b5253557SWarner Losh 129b5253557SWarner Losh2018-08-22 Arnold D. Robbins <arnold@skeeve.com> 130b5253557SWarner Losh 131b5253557SWarner Losh * awktest.tar (testdir/T.expr): Fix test for unary plus. 132b5253557SWarner Losh 133b5253557SWarner Losh2018-08-22 Arnold D. Robbins <arnold@skeeve.com> 134b5253557SWarner Losh 135b5253557SWarner Losh * REGRESS: Extract tests if necessary, set PATH to include '.'. 136b5253557SWarner Losh * regdir/beebe.tar (Makefile): Fix longwrds test to prefix 137b5253557SWarner Losh sort with LC_ALL=C. 138b5253557SWarner Losh * awktest.tar: Updated from fixed test suite, directory 139b5253557SWarner Losh it extracts is now called 'testdir' to match what's in top-level 140b5253557SWarner Losh REGRESS script. 141b5253557SWarner Losh * regdir: Removed, as Brian wants to keep the test suite in 142b5253557SWarner Losh the tar file. 143b5253557SWarner Losh 144b5253557SWarner Losh2018-08-22 Arnold D. Robbins <arnold@skeeve.com> 145b5253557SWarner Losh 146b5253557SWarner Losh * FIXES, lib.c, run.c, makefile, main.c: Merge from Brian's tree. 147b5253557SWarner Losh * REGRESS: New file, from Brian. 148b5253557SWarner Losh * awktest.tar: Restored from Brian's tree. 149b5253557SWarner Losh 150b5253557SWarner Losh2018-08-22 Arnold D. Robbins <arnold@skeeve.com> 151b5253557SWarner Losh 152b5253557SWarner Losh * awkgram.y (UPLUS): New token. In the grammar, call op1() 153b5253557SWarner Losh with it. 154b5253557SWarner Losh * maketab.c (proc): Add entry for UPLUS. 155b5253557SWarner Losh * run.c (arith): Handle UPLUS. 156b5253557SWarner Losh * main.c (version): Updated. 157b5253557SWarner Losh * bugs-fixed/unary-plus.awk, bugs-fixed/unary-plus.bad, 158b5253557SWarner Losh bugs-fixed/unary-plus.ok: New files. 159b5253557SWarner Losh 160b5253557SWarner Losh2018-08-10 Arnold D. Robbins <arnold@skeeve.com> 161b5253557SWarner Losh 162b5253557SWarner Losh * TODO: Updated. 163b5253557SWarner Losh * awk.1: Improve use of macros, add some additional explanation 164b5253557SWarner Losh in a few places, alphabetize list of variables. 165b5253557SWarner Losh 166b5253557SWarner Losh2018-08-08 Arnold D. Robbins <arnold@skeeve.com> 167b5253557SWarner Losh 168b5253557SWarner Losh * awk.h (Cell): Add new field `fmt' to track xFMT value used 169b5253557SWarner Losh for a string conversion. 170b5253557SWarner Losh [CONVC, CONVO]: New flag macros. 171b5253557SWarner Losh * bugs-fixed/README: Updated. 172b5253557SWarner Losh * bugs-fixed/string-conv.awk, bugs-fixed/string-conv.bad, 173b5253557SWarner Losh bugs-fixed/string-conv.ok: New files. 174b5253557SWarner Losh * main.c (version): Updated. 175b5253557SWarner Losh * proto.h (flags2str): Add declaration. 176b5253557SWarner Losh * tran.c (setfval): Clear CONVC and CONVO flags and set vp->fmt 177b5253557SWarner Losh to NULL. 178b5253557SWarner Losh (setsval): Ditto. Add large comment and new code to manage 179b5253557SWarner Losh correct conversion of number to string based on various flags 180b5253557SWarner Losh and the value of vp->fmt. The idea is to not convert again 181b5253557SWarner Losh if xFMT is the same as before and we're doing the same conversion. 182b5253557SWarner Losh Otherwise, clear the old flags, set the new, and reconvert. 183b5253557SWarner Losh (flags2str): New function. For debug prints and for use from a debugger. 184b5253557SWarner Losh 185b5253557SWarner Losh2018-08-05 Arnold D. Robbins <arnold@skeeve.com> 186b5253557SWarner Losh 187b5253557SWarner Losh Fix filename conflicts in regdir where the only difference was 188b5253557SWarner Losh in letter case. This caused problems on Windows systems. 189b5253557SWarner Losh 190b5253557SWarner Losh * regdir/Compare.T1: Renamed from regdir/Compare.T. 191b5253557SWarner Losh * regdir/t.delete0: Renamed from regdir/t.delete. 192b5253557SWarner Losh * regdir/t.getline1: Renamed from regdir/t.getline. 193b5253557SWarner Losh * regdir/t.redir1: Renamed from regdir/t.redir. 194b5253557SWarner Losh * regdir/t.split1: Renamed from regdir/t.split. 195b5253557SWarner Losh * regdir/t.sub0: Renamed from regdir/t.sub. 196b5253557SWarner Losh * regdir/REGRESS: Adjusted. 197b5253557SWarner Losh 198b5253557SWarner Losh2018-08-04 Arnold D. Robbins <arnold@skeeve.com> 199b5253557SWarner Losh 200b5253557SWarner Losh With scalpel, tweasers, magnifying glass and bated breath, 201b5253557SWarner Losh borrow code from the NetBSD version of nawk to fix the years-old 202b5253557SWarner Losh bug whereby decrementing the value of NF did not change the 203b5253557SWarner Losh record. 204b5253557SWarner Losh 205b5253557SWarner Losh * lib.c (fldbld): Set donerec to 1 when done. 206b5253557SWarner Losh (setlastfld): New function. 207b5253557SWarner Losh * proto.h (setlastfld): Add declaration. 208b5253557SWarner Losh * run.c (copycell): Make code smarter about flags (from NetBSD code). 209b5253557SWarner Losh * tran.c (setfree): New function. 210b5253557SWarner Losh * tran.c (setfval): Normalize negative zero to positive zero. 211b5253557SWarner Losh If setting NF, clear donerec and call setlastfld(). 212b5253557SWarner Losh (setsval): Remove call to save_old_OFS(). If setting OFS, call 213b5253557SWarner Losh recbld(). If setting NF, clear donerec and call setlastfld(). 214b5253557SWarner Losh 215b5253557SWarner Losh As part of the process, revert OFS-related changes of 2018-05-22: 216b5253557SWarner Losh 217b5253557SWarner Losh * awk.h (saveOFS, saveOFSlen, save_old_OFS): Remove declarations. 218b5253557SWarner Losh * lib.c (recbld): Use *OFS instead of saveOFS. 219b5253557SWarner Losh * run.c (saveOFS, saveOFSlen, save_old_OFS): Remove. 220b5253557SWarner Losh * tran.c (syminit): Remove initialization of saveOFS and saveOFSlen. 221b5253557SWarner Losh 222b5253557SWarner Losh General stuff that goes along with all this: 223b5253557SWarner Losh 224b5253557SWarner Losh * bugs-fixed/README: Updated. 225b5253557SWarner Losh * bugs-fixed/decr-NF.awk, bugs-fixed/decr-NF.bad, 226b5253557SWarner Losh bugs-fixed/decr-NF.ok: New files. 227b5253557SWarner Losh * main.c (version): Updated. 228b5253557SWarner Losh * regdir/README.TESTS: Fix awk book title. 229b5253557SWarner Losh * regdir/T.misc: Revise test to match fixed code. 230b5253557SWarner Losh * run.c (format): Increase size of buffer used for %a test. (Unrelated 231b5253557SWarner Losh to NF or OFS, but fixes a compiler complaint.) 232b5253557SWarner Losh 233b5253557SWarner Losh2018-06-07 Arnold D. Robbins <arnold@skeeve.com> 234b5253557SWarner Losh 235b5253557SWarner Losh * regdir/beebe.tar: Fix longwrds.ok so that the test will pass. 236b5253557SWarner Losh The file was incorrectly sorted. 237b5253557SWarner Losh 238b5253557SWarner Losh2018-06-06 Arnold D. Robbins <arnold@skeeve.com> 239b5253557SWarner Losh 240b5253557SWarner Losh * regdir/T.lilly: Fix the bug again in the second instance 241b5253557SWarner Losh of the code. Thanks to BWK for pointing this out. 242b5253557SWarner Losh 243b5253557SWarner Losh2018-05-31 Arnold D. Robbins <arnold@skeeve.com> 244b5253557SWarner Losh 245b5253557SWarner Losh * regdir/T.lilly: Fix a syntax error and ordering bug 246b5253557SWarner Losh in creating the 'foo' file. 247b5253557SWarner Losh 248b5253557SWarner Losh2018-05-23 Arnold D. Robbins <arnold@skeeve.com> 249b5253557SWarner Losh 250b5253557SWarner Losh * awk.1: Remove standalone 'awk' at the top of file, it messed up 251b5253557SWarner Losh the formatting. Arrange built-in variable list in alphabetical 252b5253557SWarner Losh order. 253b5253557SWarner Losh 254b5253557SWarner Losh2018-05-23 Arnold D. Robbins <arnold@skeeve.com> 255b5253557SWarner Losh 256b5253557SWarner Losh * main.c (version): Add my email address and a date so that 257b5253557SWarner Losh users can tell this isn't straight BWK awk. 258b5253557SWarner Losh * README.md: Minor updates. 259b5253557SWarner Losh * TODO: Updated. 260b5253557SWarner Losh 261b5253557SWarner Losh2018-05-22 Arnold D. Robbins <arnold@skeeve.com> 262b5253557SWarner Losh 263b5253557SWarner Losh Add POSIX-required formats %a and %A. 264b5253557SWarner Losh 265b5253557SWarner Losh * run.c (format): Check for %a support in C library. If there, 266b5253557SWarner Losh allow %a and %A as valid formats. 267b5253557SWarner Losh * TODO: Updated. 268b5253557SWarner Losh * bugs-fixed/README: Updated. 269b5253557SWarner Losh * bugs-fixed/a-format.awk, bugs-fixed/a-format.bad, 270b5253557SWarner Losh bugs-fixed/a-format.ok: New files. 271b5253557SWarner Losh 272b5253557SWarner Losh2018-05-22 Arnold D. Robbins <arnold@skeeve.com> 273b5253557SWarner Losh 274b5253557SWarner Losh * FIXES: Restored a line from a much earlier version that 275b5253557SWarner Losh apparently got lost when the dates were reordered. 276b5253557SWarner Losh * TODO: Updated. 277b5253557SWarner Losh 278b5253557SWarner Losh2018-05-22 Arnold D. Robbins <arnold@skeeve.com> 279b5253557SWarner Losh 280b5253557SWarner Losh * README.md: New file. 281b5253557SWarner Losh 282b5253557SWarner Losh2018-05-22 Arnold D. Robbins <arnold@skeeve.com> 283b5253557SWarner Losh 284b5253557SWarner Losh * regdir/echo.c, regdir/time.c: Minor fixes to compile without 285b5253557SWarner Losh warning on current GCC / Linux. 286b5253557SWarner Losh 287b5253557SWarner Losh2018-05-22 Arnold D. Robbins <arnold@skeeve.com> 288b5253557SWarner Losh 289b5253557SWarner Losh * TODO: New file. 290b5253557SWarner Losh 291b5253557SWarner Losh2018-05-22 Arnold D. Robbins <arnold@skeeve.com> 292b5253557SWarner Losh 293b5253557SWarner Losh * makefile (gitadd, gitpush): Remove these targets. They 294b5253557SWarner Losh should not be automated and were incorrect for things that 295b5253557SWarner Losh would be done regularly. 296b5253557SWarner Losh 297b5253557SWarner Losh2018-05-22 Arnold D. Robbins <arnold@skeeve.com> 298b5253557SWarner Losh 299b5253557SWarner Losh Fix nawk so that [[:blank:]] only matches space and tab instead 300b5253557SWarner Losh of any whitespace character, originally made May 10, 2018. 301b5253557SWarner Losh See bugs-fixed/space.awk. 302b5253557SWarner Losh 303b5253557SWarner Losh This appears to have been a thinko on Brian's part. 304b5253557SWarner Losh 305b5253557SWarner Losh * b.c (charclasses): Use xisblank() function for [[:blank:]]. 306b5253557SWarner Losh * bugs-fixed/README: Updated. 307b5253557SWarner Losh * bugs-fixed/space.awk, bugs-fixed/space.bad, 308b5253557SWarner Losh bugs-fixed/space.ok: New files. 309b5253557SWarner Losh 310b5253557SWarner Losh2018-05-22 Arnold D. Robbins <arnold@skeeve.com> 311b5253557SWarner Losh 312b5253557SWarner Losh * .gitignore: New file. 313b5253557SWarner Losh 314b5253557SWarner Losh2018-05-22 Arnold D. Robbins <arnold@skeeve.com> 315b5253557SWarner Losh 316b5253557SWarner Losh Fix nawk to provide reasonable exit status for system(), 317b5253557SWarner Losh a la gawk, originally made March 12, 2016. See 318b5253557SWarner Losh bugs-fixed/system-status.awk. 319b5253557SWarner Losh 320b5253557SWarner Losh * run.c (bltin): For FSYSTEM, use the macros defined for wait(2) 321b5253557SWarner Losh to produce a reasonable exit value, instead of doing a floating-point 322b5253557SWarner Losh division by 256. 323b5253557SWarner Losh * awk.1: Document the return status values. 324b5253557SWarner Losh * bugs-fixed/README: Updated. 325b5253557SWarner Losh * bugs-fixed/system-status.awk, bugs-fixed/system-status.bad, 326b5253557SWarner Losh bugs-fixed/system-status.ok: New files. 327b5253557SWarner Losh 328b5253557SWarner Losh2018-05-22 Arnold D. Robbins <arnold@skeeve.com> 329b5253557SWarner Losh 330b5253557SWarner Losh Bug fix with respect to rebuilding a record, originally 331b5253557SWarner Losh made August 19, 2014. See bugs-fixed/ofs-rebuild.awk. 332b5253557SWarner Losh 333b5253557SWarner Losh * awk.h (saveOFS, saveOFSlen): Declare new variables. 334b5253557SWarner Losh * lib.c (recbld): Use them when rebuilding the record. 335b5253557SWarner Losh * run.c (saveOFS, saveOFSlen): Define new variables. 336b5253557SWarner Losh (save_old_OFS): New function to save OFS aside. 337b5253557SWarner Losh * tran.c (syminit): Initialize saveOFS and saveOFSlen. 338b5253557SWarner Losh (setsval): If setting a field, call save_old_OFS(). 339b5253557SWarner Losh * bugs-fixed/README, bugs-fixed/ofs-rebuild.awk, 340b5253557SWarner Losh bugs-fixed/ofs-rebuild.bad, bugs-fixed/ofs-rebuild.ok: New files. 341b5253557SWarner Losh 342b5253557SWarner Losh2018-05-22 Arnold D. Robbins <arnold@skeeve.com> 343b5253557SWarner Losh 344b5253557SWarner Losh * makefile (YACC): Use bison. 345b5253557SWarner Losh 346b5253557SWarner Losh2018-05-22 Arnold D. Robbins <arnold@skeeve.com> 347b5253557SWarner Losh 348b5253557SWarner Losh * ChangeLog: Created. 349b5253557SWarner Losh * regdir: Created. Based on contents of awktest.a. 350b5253557SWarner Losh * .gitattributes: Created, to preserve CR LF in regdir/t.crlf. 351b5253557SWarner Losh * awktest.a: Removed. 352b5253557SWarner Losh * regdir/T.gawk, regdir/T.latin1: Updated from awktest.tar. 353b5253557SWarner Losh * awktest.tar: Removed. 354