head 1.4; access; symbols pkgsrc-2023Q4:1.4.0.8 pkgsrc-2023Q4-base:1.4 pkgsrc-2023Q3:1.4.0.6 pkgsrc-2023Q3-base:1.4 pkgsrc-2023Q2:1.4.0.4 pkgsrc-2023Q2-base:1.4 pkgsrc-2023Q1:1.4.0.2 pkgsrc-2023Q1-base:1.4 pkgsrc-2022Q4:1.3.0.130 pkgsrc-2022Q4-base:1.3 pkgsrc-2022Q3:1.3.0.128 pkgsrc-2022Q3-base:1.3 pkgsrc-2022Q2:1.3.0.126 pkgsrc-2022Q2-base:1.3 pkgsrc-2022Q1:1.3.0.124 pkgsrc-2022Q1-base:1.3 pkgsrc-2021Q4:1.3.0.122 pkgsrc-2021Q4-base:1.3 pkgsrc-2021Q3:1.3.0.120 pkgsrc-2021Q3-base:1.3 pkgsrc-2021Q2:1.3.0.118 pkgsrc-2021Q2-base:1.3 pkgsrc-2021Q1:1.3.0.116 pkgsrc-2021Q1-base:1.3 pkgsrc-2020Q4:1.3.0.114 pkgsrc-2020Q4-base:1.3 pkgsrc-2020Q3:1.3.0.112 pkgsrc-2020Q3-base:1.3 pkgsrc-2020Q2:1.3.0.108 pkgsrc-2020Q2-base:1.3 pkgsrc-2020Q1:1.3.0.88 pkgsrc-2020Q1-base:1.3 pkgsrc-2019Q4:1.3.0.110 pkgsrc-2019Q4-base:1.3 pkgsrc-2019Q3:1.3.0.106 pkgsrc-2019Q3-base:1.3 pkgsrc-2019Q2:1.3.0.104 pkgsrc-2019Q2-base:1.3 pkgsrc-2019Q1:1.3.0.102 pkgsrc-2019Q1-base:1.3 pkgsrc-2018Q4:1.3.0.100 pkgsrc-2018Q4-base:1.3 pkgsrc-2018Q3:1.3.0.98 pkgsrc-2018Q3-base:1.3 pkgsrc-2018Q2:1.3.0.96 pkgsrc-2018Q2-base:1.3 pkgsrc-2018Q1:1.3.0.94 pkgsrc-2018Q1-base:1.3 pkgsrc-2017Q4:1.3.0.92 pkgsrc-2017Q4-base:1.3 pkgsrc-2017Q3:1.3.0.90 pkgsrc-2017Q3-base:1.3 pkgsrc-2017Q2:1.3.0.86 pkgsrc-2017Q2-base:1.3 pkgsrc-2017Q1:1.3.0.84 pkgsrc-2017Q1-base:1.3 pkgsrc-2016Q4:1.3.0.82 pkgsrc-2016Q4-base:1.3 pkgsrc-2016Q3:1.3.0.80 pkgsrc-2016Q3-base:1.3 pkgsrc-2016Q2:1.3.0.78 pkgsrc-2016Q2-base:1.3 pkgsrc-2016Q1:1.3.0.76 pkgsrc-2016Q1-base:1.3 pkgsrc-2015Q4:1.3.0.74 pkgsrc-2015Q4-base:1.3 pkgsrc-2015Q3:1.3.0.72 pkgsrc-2015Q3-base:1.3 pkgsrc-2015Q2:1.3.0.70 pkgsrc-2015Q2-base:1.3 pkgsrc-2015Q1:1.3.0.68 pkgsrc-2015Q1-base:1.3 pkgsrc-2014Q4:1.3.0.66 pkgsrc-2014Q4-base:1.3 pkgsrc-2014Q3:1.3.0.64 pkgsrc-2014Q3-base:1.3 pkgsrc-2014Q2:1.3.0.62 pkgsrc-2014Q2-base:1.3 pkgsrc-2014Q1:1.3.0.60 pkgsrc-2014Q1-base:1.3 pkgsrc-2013Q4:1.3.0.58 pkgsrc-2013Q4-base:1.3 pkgsrc-2013Q3:1.3.0.56 pkgsrc-2013Q3-base:1.3 pkgsrc-2013Q2:1.3.0.54 pkgsrc-2013Q2-base:1.3 pkgsrc-2013Q1:1.3.0.52 pkgsrc-2013Q1-base:1.3 pkgsrc-2012Q4:1.3.0.50 pkgsrc-2012Q4-base:1.3 pkgsrc-2012Q3:1.3.0.48 pkgsrc-2012Q3-base:1.3 pkgsrc-2012Q2:1.3.0.46 pkgsrc-2012Q2-base:1.3 pkgsrc-2012Q1:1.3.0.44 pkgsrc-2012Q1-base:1.3 pkgsrc-2011Q4:1.3.0.42 pkgsrc-2011Q4-base:1.3 pkgsrc-2011Q3:1.3.0.40 pkgsrc-2011Q3-base:1.3 pkgsrc-2011Q2:1.3.0.38 pkgsrc-2011Q2-base:1.3 pkgsrc-2011Q1:1.3.0.36 pkgsrc-2011Q1-base:1.3 pkgsrc-2010Q4:1.3.0.34 pkgsrc-2010Q4-base:1.3 pkgsrc-2010Q3:1.3.0.32 pkgsrc-2010Q3-base:1.3 pkgsrc-2010Q2:1.3.0.30 pkgsrc-2010Q2-base:1.3 pkgsrc-2010Q1:1.3.0.28 pkgsrc-2010Q1-base:1.3 pkgsrc-2009Q4:1.3.0.26 pkgsrc-2009Q4-base:1.3 pkgsrc-2009Q3:1.3.0.24 pkgsrc-2009Q3-base:1.3 pkgsrc-2009Q2:1.3.0.22 pkgsrc-2009Q2-base:1.3 pkgsrc-2009Q1:1.3.0.20 pkgsrc-2009Q1-base:1.3 pkgsrc-2008Q4:1.3.0.18 pkgsrc-2008Q4-base:1.3 pkgsrc-2008Q3:1.3.0.16 pkgsrc-2008Q3-base:1.3 cube-native-xorg:1.3.0.14 cube-native-xorg-base:1.3 pkgsrc-2008Q2:1.3.0.12 pkgsrc-2008Q2-base:1.3 cwrapper:1.3.0.10 pkgsrc-2008Q1:1.3.0.8 pkgsrc-2008Q1-base:1.3 pkgsrc-2007Q4:1.3.0.6 pkgsrc-2007Q4-base:1.3 pkgsrc-2007Q3:1.3.0.4 pkgsrc-2007Q3-base:1.3 pkgsrc-2007Q2:1.3.0.2 pkgsrc-2007Q2-base:1.3 pkgsrc-2007Q1:1.1.0.6 pkgsrc-2007Q1-base:1.1 pkgsrc-2006Q4:1.1.0.4 pkgsrc-2006Q4-base:1.1 pkgsrc-2006Q3:1.1.0.2 pkgsrc-2006Q3-base:1.1; locks; strict; comment @# @; 1.4 date 2023.02.24.20.57.50; author vins; state Exp; branches; next 1.3; commitid LjxGGFZN8RxOYOeE; 1.3 date 2007.05.27.09.55.53; author schmonz; state Exp; branches; next 1.2; 1.2 date 2007.05.07.22.39.07; author rillig; state Exp; branches; next 1.1; 1.1 date 2006.07.14.14.23.06; author jlam; state Exp; branches; next ; desc @@ 1.4 log @lang/nawk: update to release 20220122. ## CHANGES 2020-07-30 Arnold D. Robbins By fiat, we use bison for $(YACC). Trying to accommodate different versions didn't work. * makefile: Significant cleanup. Replace all ytab* references with awkgram.tab.* and simplify definition of YACC. * .gitignore: Remove ytab* references. * b.c, lex.c, maketab.c, parse.c, run.c: Replace include of ytab.h with awkgram.tab.h. * lib.c, main.c, tran.c: Remove include of ytab.h, wasn't needed. 2020-01-20 Arnold D. Robbins * run.c (openfile): Set the close-on-exec flag for file and pipe redirections that aren't stdin/stdout/stderr. 2020-01-06 Arnold D. Robbins Minor fixes. * b.c (replace_repeat): Turn init_q back into an int. * lex.c (string): Use \a instead of \007. * tran.c (catstr): Use snprintf instead of sprintf. 2020-01-01 Arnold D. Robbins * tran.c (syminit, arginit, envinit): Free sval member before setting it. Thanks to valgrind. * b.c: Small formatting cleanups in several routines. 2019-12-27 Arnold D. Robbins * b.c (replace_repeat): Fix a bug whereby a{0,3} could match four a's. Thanks to Anonymous AWK fan for the report. Also, minor code formatting cleanups. * testdir/T.int-expr: New file. 2019-12-11 Arnold D. Robbins * README: Renamed to ... * README.md: ... this. Cleaned up some as well, including moving to Markdown. 2019-11-08 Arnold D. Robbins * test/T.chem: Use $oldawk instead of hardwiring 'awk'. * test/T.lilly: Remove gawk warnings from output, improves portability. 2019-10-07 Arnold D. Robbins * b.c (fnematch): Change type of pbuf from unsigned char to char. * proto.h (fnematch): Ditto. 2019-10-06 Arnold D. Robbins * lib.c (readrec): Allow RS a regular expression. Imported the code from the NetBSD awk. * b.c (fnematch): New function for implementing the feature. * awk.1: Updated. * main.c (version): Updated. 2019-06-24 Arnold D. Robbins * makefile: Revise to take into account there is no more awktest.tar, add targets 'check' and 'test', and also 'testclean' to clean up after test run. Have 'clean' and 'cleaner' depend upon 'testclean'. 2019-06-23 Arnold D. Robbins * testdir: Extracted from awktest.tar and added to Git. * awktest.tar: Removed. 2019-06-06 Arnold D. Robbins * awk.1: Fix a typo, minor edits. 2019-06-05 Arnold D. Robbins * b.c (relex): Count parentheses and treat umatched right paren as a literal character. * awktest.tar (testdir/T.re): Added a test case. * main.c (version): Updated. 2019-05-29 Arnold D. Robbins * lib.c (isclvar): Remove check for additional '=' after first one. No longer needed. 2019-01-26 Arnold D. Robbins * main.c (version): Updated. 2019-01-25 Arnold D. Robbins * run.c (awkgetline): Check for numeric value in all getline variants. See the numeric-getline.* files in bugs-fixed directory. 2018-08-29 Arnold D. Robbins * REGRESS: Check for existence of a.out. If not there, run make. Enable core dumps for T.arnold system status test to work on MacOS X. 2018-08-22 Arnold D. Robbins * awktest.tar (testdir/T.expr): Fix test for unary plus. 2018-08-22 Arnold D. Robbins * REGRESS: Extract tests if necessary, set PATH to include '.'. * regdir/beebe.tar (Makefile): Fix longwrds test to prefix sort with LC_ALL=C. * awktest.tar: Updated from fixed test suite, directory it extracts is now called 'testdir' to match what's in top-level REGRESS script. * regdir: Removed, as Brian wants to keep the test suite in the tar file. 2018-08-22 Arnold D. Robbins * FIXES, lib.c, run.c, makefile, main.c: Merge from Brian's tree. * REGRESS: New file, from Brian. * awktest.tar: Restored from Brian's tree. 2018-08-22 Arnold D. Robbins * awkgram.y (UPLUS): New token. In the grammar, call op1() with it. * maketab.c (proc): Add entry for UPLUS. * run.c (arith): Handle UPLUS. * main.c (version): Updated. * bugs-fixed/unary-plus.awk, bugs-fixed/unary-plus.bad, bugs-fixed/unary-plus.ok: New files. 2018-08-10 Arnold D. Robbins * TODO: Updated. * awk.1: Improve use of macros, add some additional explanation in a few places, alphabetize list of variables. 2018-08-08 Arnold D. Robbins * awk.h (Cell): Add new field `fmt' to track xFMT value used for a string conversion. [CONVC, CONVO]: New flag macros. * bugs-fixed/README: Updated. * bugs-fixed/string-conv.awk, bugs-fixed/string-conv.bad, bugs-fixed/string-conv.ok: New files. * main.c (version): Updated. * proto.h (flags2str): Add declaration. * tran.c (setfval): Clear CONVC and CONVO flags and set vp->fmt to NULL. (setsval): Ditto. Add large comment and new code to manage correct conversion of number to string based on various flags and the value of vp->fmt. The idea is to not convert again if xFMT is the same as before and we're doing the same conversion. Otherwise, clear the old flags, set the new, and reconvert. (flags2str): New function. For debug prints and for use from a debugger. 2018-08-05 Arnold D. Robbins Fix filename conflicts in regdir where the only difference was in letter case. This caused problems on Windows systems. * regdir/Compare.T1: Renamed from regdir/Compare.T. * regdir/t.delete0: Renamed from regdir/t.delete. * regdir/t.getline1: Renamed from regdir/t.getline. * regdir/t.redir1: Renamed from regdir/t.redir. * regdir/t.split1: Renamed from regdir/t.split. * regdir/t.sub0: Renamed from regdir/t.sub. * regdir/REGRESS: Adjusted. 2018-08-04 Arnold D. Robbins With scalpel, tweasers, magnifying glass and bated breath, borrow code from the NetBSD version of nawk to fix the years-old bug whereby decrementing the value of NF did not change the record. * lib.c (fldbld): Set donerec to 1 when done. (setlastfld): New function. * proto.h (setlastfld): Add declaration. * run.c (copycell): Make code smarter about flags (from NetBSD code). * tran.c (setfree): New function. * tran.c (setfval): Normalize negative zero to positive zero. If setting NF, clear donerec and call setlastfld(). (setsval): Remove call to save_old_OFS(). If setting OFS, call recbld(). If setting NF, clear donerec and call setlastfld(). As part of the process, revert OFS-related changes of 2018-05-22: * awk.h (saveOFS, saveOFSlen, save_old_OFS): Remove declarations. * lib.c (recbld): Use *OFS instead of saveOFS. * run.c (saveOFS, saveOFSlen, save_old_OFS): Remove. * tran.c (syminit): Remove initialization of saveOFS and saveOFSlen. General stuff that goes along with all this: * bugs-fixed/README: Updated. * bugs-fixed/decr-NF.awk, bugs-fixed/decr-NF.bad, bugs-fixed/decr-NF.ok: New files. * main.c (version): Updated. * regdir/README.TESTS: Fix awk book title. * regdir/T.misc: Revise test to match fixed code. * run.c (format): Increase size of buffer used for %a test. (Unrelated to NF or OFS, but fixes a compiler complaint.) 2018-06-07 Arnold D. Robbins * regdir/beebe.tar: Fix longwrds.ok so that the test will pass. The file was incorrectly sorted. 2018-06-06 Arnold D. Robbins * regdir/T.lilly: Fix the bug again in the second instance of the code. Thanks to BWK for pointing this out. 2018-05-31 Arnold D. Robbins * regdir/T.lilly: Fix a syntax error and ordering bug in creating the 'foo' file. 2018-05-23 Arnold D. Robbins * awk.1: Remove standalone 'awk' at the top of file, it messed up the formatting. Arrange built-in variable list in alphabetical order. 2018-05-23 Arnold D. Robbins * main.c (version): Add my email address and a date so that users can tell this isn't straight BWK awk. * README.md: Minor updates. * TODO: Updated. 2018-05-22 Arnold D. Robbins Add POSIX-required formats %a and %A. * run.c (format): Check for %a support in C library. If there, allow %a and %A as valid formats. * TODO: Updated. * bugs-fixed/README: Updated. * bugs-fixed/a-format.awk, bugs-fixed/a-format.bad, bugs-fixed/a-format.ok: New files. 2018-05-22 Arnold D. Robbins * FIXES: Restored a line from a much earlier version that apparently got lost when the dates were reordered. * TODO: Updated. 2018-05-22 Arnold D. Robbins * README.md: New file. 2018-05-22 Arnold D. Robbins * regdir/echo.c, regdir/time.c: Minor fixes to compile without warning on current GCC / Linux. 2018-05-22 Arnold D. Robbins * TODO: New file. 2018-05-22 Arnold D. Robbins * makefile (gitadd, gitpush): Remove these targets. They should not be automated and were incorrect for things that would be done regularly. 2018-05-22 Arnold D. Robbins Fix nawk so that [[:blank:]] only matches space and tab instead of any whitespace character, originally made May 10, 2018. See bugs-fixed/space.awk. This appears to have been a thinko on Brian's part. * b.c (charclasses): Use xisblank() function for [[:blank:]]. * bugs-fixed/README: Updated. * bugs-fixed/space.awk, bugs-fixed/space.bad, bugs-fixed/space.ok: New files. 2018-05-22 Arnold D. Robbins * .gitignore: New file. 2018-05-22 Arnold D. Robbins Fix nawk to provide reasonable exit status for system(), a la gawk, originally made March 12, 2016. See bugs-fixed/system-status.awk. * run.c (bltin): For FSYSTEM, use the macros defined for wait(2) to produce a reasonable exit value, instead of doing a floating-point division by 256. * awk.1: Document the return status values. * bugs-fixed/README: Updated. * bugs-fixed/system-status.awk, bugs-fixed/system-status.bad, bugs-fixed/system-status.ok: New files. 2018-05-22 Arnold D. Robbins Bug fix with respect to rebuilding a record, originally made August 19, 2014. See bugs-fixed/ofs-rebuild.awk. * awk.h (saveOFS, saveOFSlen): Declare new variables. * lib.c (recbld): Use them when rebuilding the record. * run.c (saveOFS, saveOFSlen): Define new variables. (save_old_OFS): New function to save OFS aside. * tran.c (syminit): Initialize saveOFS and saveOFSlen. (setsval): If setting a field, call save_old_OFS(). * bugs-fixed/README, bugs-fixed/ofs-rebuild.awk, bugs-fixed/ofs-rebuild.bad, bugs-fixed/ofs-rebuild.ok: New files. 2018-05-22 Arnold D. Robbins * makefile (YACC): Use bison. 2018-05-22 Arnold D. Robbins * ChangeLog: Created. * regdir: Created. Based on contents of awktest.a. * .gitattributes: Created, to preserve CR LF in regdir/t.crlf. * awktest.a: Removed. * regdir/T.gawk, regdir/T.latin1: Updated from awktest.tar. * awktest.tar: Removed. @ text @# $NetBSD: Makefile,v 1.3 2007/05/27 09:55:53 schmonz Exp $ # # This file is copied from "makefile.orig" with the following # modifications for pkgsrc: # # * Some problematic comment lines and unnecessary make targets have # been stripped. # * Use the supplied awkgram.tab.[ch] files instead of regenerating # them with yacc. # * Use the supplied proctab.c file instead of regenerating it # with maketab. # CFLAGS = -fsanitize=address -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls CFLAGS = -g CFLAGS = CFLAGS = -O2 CC = gcc -g -Wall -pedantic -Wcast-qual CC = cc YACC = yacc -d -b awkgram YACC = bison -d OFILES = b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o SOURCE = awk.h awkgram.tab.c awkgram.tab.h proto.h awkgram.y lex.c b.c main.c \ maketab.c parse.c lib.c run.c tran.c proctab.c LISTING = awk.h proto.h awkgram.y lex.c b.c main.c maketab.c parse.c \ lib.c run.c tran.c SHIP = README FIXES $(SOURCE) awkgram.tab.[ch].bak makefile \ awk.1 a.out: awkgram.tab.o $(OFILES) $(CC) $(CFLAGS) awkgram.tab.o $(OFILES) $(ALLOC) -lm -o $@@ maketab: awkgram.tab.h maketab.c $(CC) $(CFLAGS) maketab.c -o maketab clean: rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov *.gcno *.gcda @ 1.3 log @Rename "makefile" to "makefile.orig" to avoid case-insensitive filename clash with "Makefile". @ text @d1 1 a1 1 # $NetBSD: Makefile,v 1.2 2007/05/07 22:39:07 rillig Exp $ d6 4 a9 3 # * Some problematic comments lines were stripped. # * Use the supplied ytab.[ch] files instead of regenerating them # with yacc. d14 1 d16 1 a17 1 CFLAGS = d19 1 a19 3 CC = gcc -Wall -g -Wwrite-strings CC = gcc -fprofile-arcs -ftest-coverage CC = gcc -Wall -g d22 2 a23 3 YACC = bison -y YACC = yacc YFLAGS = -d d27 2 a28 2 SOURCE = awk.h ytab.c ytab.h proto.h awkgram.y lex.c b.c main.c \ maketab.c parse.c lib.c run.c tran.c proctab.c missing95.c d31 4 a34 1 lib.c run.c tran.c missing95.c d36 2 a37 2 SHIP = README FIXES $(SOURCE) ytab[ch].bak makefile makefile.win \ vcvars32.bat buildwin.bat mac.code awk.1 d39 2 a40 2 a.out: ytab.o $(OFILES) $(CC) $(CFLAGS) ytab.o $(OFILES) $(ALLOC) -lm -o $@@ d43 1 a43 1 rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov # proctab.c @ 1.2 log @Always create the file a.out, even on Cygwin, where the default is a.exe. @ text @d1 1 a1 1 # $NetBSD: Makefile,v 1.1 2006/07/14 14:23:06 jlam Exp $ d3 2 a4 2 # This file is copied from "makefile" with the following modifications # for pkgsrc: @ 1.1 log @Prepare nawk for use as a bootstrap tool by including the sources directly in pkgsrc/lang/nawk/files and adjusting the package Makefile accordingly. The README.pkgsrc file includes notes on how the source files were (minimally) adjusted. @ text @d1 1 a1 1 # $NetBSD$ d38 1 a38 1 $(CC) $(CFLAGS) ytab.o $(OFILES) $(ALLOC) -lm @