svn commit: r348505 - in vendor/one-true-awk/dist: . bugs-fixed

Warner Losh imp at FreeBSD.org
Sun Jun 2 04:23:59 UTC 2019


Author: imp
Date: Sun Jun  2 04:23:56 2019
New Revision: 348505
URL: https://svnweb.freebsd.org/changeset/base/348505

Log:
  Import latest one-true-awk from upstream
  
  Import git hash 4189ef5d from https://github.com/onetrueawk/awk.git as
  there's not been a release in a while.
  
  Upstream one-true-awk woke-up! Time to catch up. This may also revert
  FreeBSD changes that we'd placed in the vendor branch in anticipation
  of their inclusion in upstream. That's not yet the case, and these
  will be resolved in the merge.
  
  See FIXES for a complete list of bugs fixed (starting with the Jun 7,
  2018 entry).

Added:
  vendor/one-true-awk/dist/ChangeLog
  vendor/one-true-awk/dist/LICENSE
  vendor/one-true-awk/dist/REGRESS   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/
  vendor/one-true-awk/dist/bugs-fixed/README
  vendor/one-true-awk/dist/bugs-fixed/a-format.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/a-format.bad
  vendor/one-true-awk/dist/bugs-fixed/a-format.ok
  vendor/one-true-awk/dist/bugs-fixed/concat-assign-same.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/concat-assign-same.bad
  vendor/one-true-awk/dist/bugs-fixed/concat-assign-same.ok
  vendor/one-true-awk/dist/bugs-fixed/decr-NF.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/decr-NF.bad
  vendor/one-true-awk/dist/bugs-fixed/decr-NF.ok
  vendor/one-true-awk/dist/bugs-fixed/fmt-overflow.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/fmt-overflow.ok
  vendor/one-true-awk/dist/bugs-fixed/fs-overflow.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/getline-numeric.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/getline-numeric.bad
  vendor/one-true-awk/dist/bugs-fixed/getline-numeric.in   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/getline-numeric.ok
  vendor/one-true-awk/dist/bugs-fixed/missing-precision.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/missing-precision.ok
  vendor/one-true-awk/dist/bugs-fixed/negative-nf.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/negative-nf.ok
  vendor/one-true-awk/dist/bugs-fixed/nf-self-assign.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/nf-self-assign.bad
  vendor/one-true-awk/dist/bugs-fixed/nf-self-assign.ok
  vendor/one-true-awk/dist/bugs-fixed/numeric-fs.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/numeric-fs.ok
  vendor/one-true-awk/dist/bugs-fixed/numeric-output-seps.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/numeric-output-seps.bad
  vendor/one-true-awk/dist/bugs-fixed/numeric-output-seps.ok
  vendor/one-true-awk/dist/bugs-fixed/numeric-rs.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/numeric-rs.bad
  vendor/one-true-awk/dist/bugs-fixed/numeric-rs.ok
  vendor/one-true-awk/dist/bugs-fixed/numeric-subsep.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/numeric-subsep.bad   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/numeric-subsep.ok
  vendor/one-true-awk/dist/bugs-fixed/ofs-rebuild.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/ofs-rebuild.bad
  vendor/one-true-awk/dist/bugs-fixed/ofs-rebuild.ok
  vendor/one-true-awk/dist/bugs-fixed/space.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/space.bad
  vendor/one-true-awk/dist/bugs-fixed/space.ok
  vendor/one-true-awk/dist/bugs-fixed/split-fs-from-array.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/split-fs-from-array.ok
  vendor/one-true-awk/dist/bugs-fixed/string-conv.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/string-conv.bad
  vendor/one-true-awk/dist/bugs-fixed/string-conv.ok
  vendor/one-true-awk/dist/bugs-fixed/subsep-overflow.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/subsep-overflow.ok
  vendor/one-true-awk/dist/bugs-fixed/system-status.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/system-status.bad
  vendor/one-true-awk/dist/bugs-fixed/system-status.ok
  vendor/one-true-awk/dist/bugs-fixed/unary-plus.awk   (contents, props changed)
  vendor/one-true-awk/dist/bugs-fixed/unary-plus.bad
  vendor/one-true-awk/dist/bugs-fixed/unary-plus.ok
  vendor/one-true-awk/dist/proctab.c   (contents, props changed)
Modified:
  vendor/one-true-awk/dist/FIXES
  vendor/one-true-awk/dist/awk.1
  vendor/one-true-awk/dist/awk.h
  vendor/one-true-awk/dist/awkgram.y
  vendor/one-true-awk/dist/b.c
  vendor/one-true-awk/dist/lex.c
  vendor/one-true-awk/dist/lib.c
  vendor/one-true-awk/dist/main.c
  vendor/one-true-awk/dist/makefile
  vendor/one-true-awk/dist/maketab.c
  vendor/one-true-awk/dist/parse.c
  vendor/one-true-awk/dist/proto.h
  vendor/one-true-awk/dist/run.c
  vendor/one-true-awk/dist/tran.c

Added: vendor/one-true-awk/dist/ChangeLog
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/one-true-awk/dist/ChangeLog	Sun Jun  2 04:23:56 2019	(r348505)
@@ -0,0 +1,245 @@
+2019-05-29         Arnold D. Robbins     <arnold at skeeve.com>
+
+	* lib.c (isclvar): Remove check for additional '=' after
+	first one. No longer needed.
+
+2019-01-26         Arnold D. Robbins     <arnold at skeeve.com>
+
+	* main.c (version): Updated.
+
+2019-01-25         Arnold D. Robbins     <arnold at skeeve.com>
+
+	* 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     <arnold at skeeve.com>
+
+	* 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     <arnold at skeeve.com>
+
+	* awktest.tar (testdir/T.expr): Fix test for unary plus.
+
+2018-08-22         Arnold D. Robbins     <arnold at skeeve.com>
+
+	* 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     <arnold at skeeve.com>
+
+	* 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     <arnold at skeeve.com>
+
+	* 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     <arnold at skeeve.com>
+
+	* 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     <arnold at skeeve.com>
+
+	* 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     <arnold at skeeve.com>
+
+	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     <arnold at skeeve.com>
+
+	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     <arnold at skeeve.com>
+
+	* regdir/beebe.tar: Fix longwrds.ok so that the test will pass.
+	The file was incorrectly sorted.
+
+2018-06-06         Arnold D. Robbins     <arnold at skeeve.com>
+
+	* 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     <arnold at skeeve.com>
+
+	* regdir/T.lilly: Fix a syntax error and ordering bug
+	in creating the 'foo' file.
+
+2018-05-23         Arnold D. Robbins     <arnold at skeeve.com>
+
+	* 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     <arnold at skeeve.com>
+
+	* 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     <arnold at skeeve.com>
+
+	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     <arnold at skeeve.com>
+
+	* 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     <arnold at skeeve.com>
+
+	* README.md: New file.
+
+2018-05-22         Arnold D. Robbins     <arnold at skeeve.com>
+
+	* regdir/echo.c, regdir/time.c: Minor fixes to compile without
+	warning on current GCC / Linux.
+
+2018-05-22         Arnold D. Robbins     <arnold at skeeve.com>
+
+	* TODO: New file.
+
+2018-05-22         Arnold D. Robbins     <arnold at skeeve.com>
+
+	* 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     <arnold at skeeve.com>
+
+	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     <arnold at skeeve.com>
+
+	* .gitignore: New file.
+
+2018-05-22         Arnold D. Robbins     <arnold at skeeve.com>
+
+	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     <arnold at skeeve.com>
+
+	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     <arnold at skeeve.com>
+
+	* makefile (YACC): Use bison.
+
+2018-05-22         Arnold D. Robbins     <arnold at skeeve.com>
+
+	* 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.

Modified: vendor/one-true-awk/dist/FIXES
==============================================================================
--- vendor/one-true-awk/dist/FIXES	Sun Jun  2 04:04:21 2019	(r348504)
+++ vendor/one-true-awk/dist/FIXES	Sun Jun  2 04:23:56 2019	(r348505)
@@ -25,6 +25,113 @@ THIS SOFTWARE.
 This file lists all bug fixes, changes, etc., made since the AWK book
 was sent to the printers in August, 1987.
 
+May 29,2019:
+	Fix check for command line arguments to no longer require that
+	first character after '=' not be another '='. Reverts change of
+	August 11, 1989. Thanks to GitHub user Jamie Landeg Jones for
+	pointing out the issue; from Issue #38.
+
+Apr 7, 2019:
+	Update awktest.tar(p.50) to use modern options to sort. Needed
+	for Android development. Thanks to GitHub user mohd-akram (Mohamed
+	Akram).  From Comment #33.
+
+Mar 12, 2019:
+	Added very simplistic support for cross-compiling in the
+	makefile.  We are NOT going to go in the direction of the
+	autotools, though.  Thanks to GitHub user nee-san for
+	the basic change. (Merged from PR #34.)
+
+Mar 5, 2019:
+	Added support for POSIX-standard interval expressions (a.k.a.
+	bounds, a.k.a. repetition expressions) in regular expressions,
+	backported (via NetBSD) from Apple awk-24 (20070501).
+	Thanks to Martijn Dekker <martijn at inlv.org> for the port.
+	(Merged from PR #30.)
+
+Mar 3, 2019:
+	Merge PRs as follows:
+	#12: Avoid undefined behaviour when using ctype(3) functions in
+	     relex(). Thanks to GitHub user iamleot.
+	#31: Make getline handle numeric strings, and update FIXES. Thanks
+	     to GitHub user arnoldrobbins
+	#32: maketab: support build systems with read-only source. Thanks
+	     to GitHub user enh.
+
+Jan 25, 2019:
+	Make getline handle numeric strings properly in all cases.
+	(Thanks, Arnold.)
+
+Jan 21, 2019:
+	Merged a number of small fixes from GitHub pull requests.
+	Thanks to GitHub users Arnold Robbins (arnoldrobbins),
+	Cody Mello (melloc) and Christoph Junghans (junghans).
+	PR numbers: 13-21, 23, 24, 27.
+
+Oct 25, 2018:
+	Added test in maketab.c to prevent generating a proctab entry
+	for YYSTYPE_IS_DEFINED.  It was harmless but some gcc settings
+	generated a warning message.  Thanks to Nan Xiao for report.
+
+Aug 27, 2018:
+	Disallow '$' in printf formats; arguments evaluated in order
+	and printed in order.
+
+	Added some casts to silence warnings on debugging printfs.
+	(Thanks, Arnold.)
+
+Aug 23, 2018:
+        A long list of fixes courtesy of Arnold Robbins,
+        to whom profound thanks.
+
+        1. ofs-rebuild: OFS value used to rebuild the record was incorrect.
+        Fixed August 19, 2014. Revised fix August 2018.
+
+        2. system-status: Instead of a floating-point division by 256, use
+        the wait(2) macros to create a reasonable exit status.
+        Fixed March 12, 2016.
+
+        3. space: Use provided xisblank() function instead of ispace() for
+        matching [[:blank:]].
+
+        4. a-format: Add POSIX standard %a and %A to supported formats. Check
+        at runtime that this format is available.
+
+        5. decr-NF: Decrementing NF did not change $0. This is a decades-old
+        bug. There are interactions with the old and new value of OFS as well.
+        Most of the fix came from the NetBSD awk.
+
+        6. string-conv: String conversions of scalars were sticky.  Once a
+        conversion to string happened, even with OFMT, that value was used until
+        a new numeric value was assigned, even if OFMT differed from CONVFMT,
+        and also if CONVFMT changed.
+
+        7. unary-plus: Unary plus on a string constant returned the string.
+        Instead, it should convert the value to numeric and give that value.
+
+	Also added Arnold's tests for these to awktest.tar as T.arnold.
+
+Aug 15, 2018:
+	fixed mangled awktest.tar (thanks, Arnold), posted all
+	current (very minor) fixes to github / onetrueawk
+
+Jun 7, 2018:
+	(yes, a long layoff)
+	Updated some broken tests (beebe.tar, T.lilly)
+	[thanks to Arnold Robbins]
+
+Mar 26, 2015:
+	buffer overflow in error reporting; thanks to tobias ulmer
+	and john-mark gurney for spotting it and the fix.
+
+Feb 4, 2013:
+	cleaned up a handful of tests that didn't seem to actually
+	test for correct behavior: T.latin1, T.gawk.
+
+Jan 5, 2013:
+	added ,NULL initializer to static Cells in run.c; not really
+	needed but cleaner.  Thanks to Michael Bombardieri.
+
 Dec 20, 2012:
 	fiddled makefile to get correct yacc and bison flags.  pick yacc
 	(linux) or bison (mac) as necessary.
@@ -492,6 +599,8 @@ May 12, 1998:
 
 Mar 12, 1998:
 	added -V to print version number and die.
+
+[notify dave kerns, dkerns at dacsoup.ih.lucent.com]
 
 Feb 11, 1998:
 	subtle silent bug in lex.c: if the program ended with a number

Added: vendor/one-true-awk/dist/LICENSE
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/one-true-awk/dist/LICENSE	Sun Jun  2 04:23:56 2019	(r348505)
@@ -0,0 +1,23 @@
+/****************************************************************
+Copyright (C) Lucent Technologies 1997
+All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and
+its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appear in all
+copies and that both that the copyright notice and this
+permission notice and warranty disclaimer appear in supporting
+documentation, and that the name Lucent Technologies or any of
+its entities not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior
+permission.
+
+LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
+SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+THIS SOFTWARE.
+****************************************************************/

Added: vendor/one-true-awk/dist/REGRESS
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/one-true-awk/dist/REGRESS	Sun Jun  2 04:23:56 2019	(r348505)
@@ -0,0 +1,35 @@
+#! /bin/sh
+
+case `uname` in
+CYGWIN)	EXE=a.exe ;;
+*)	EXE=a.out ;;
+esac
+
+if [ ! -f $EXE ]
+then
+	make || exit 1
+fi
+
+if [ -d testdir ]
+then
+	true	# do nothing
+elif [ -f awktest.tar ]
+then
+	echo extracting testdir
+	tar -xpf awktest.tar
+else
+	echo $0: No testdir directory and no awktest.tar to extract it from! >&2
+	exit 1
+fi
+
+cd testdir
+pwd
+PATH=.:$PATH
+export PATH
+if (ulimit -c unlimited > /dev/null 2>&1)
+then
+	# Workaround broken default on MacOS X
+	ulimit -c unlimited
+fi
+
+REGRESS

Modified: vendor/one-true-awk/dist/awk.1
==============================================================================
--- vendor/one-true-awk/dist/awk.1	Sun Jun  2 04:04:21 2019	(r348504)
+++ vendor/one-true-awk/dist/awk.1	Sun Jun  2 04:23:56 2019	(r348505)
@@ -7,7 +7,6 @@
 .fi
 .ft 1
 ..
-awk
 .TH AWK 1
 .CT 1 files prog_other
 .SH NAME
@@ -36,7 +35,7 @@ awk \- pattern-directed scanning and processing langua
 scans each input
 .I file
 for lines that match any of a set of patterns specified literally in
-.IR prog
+.I prog
 or in one or more files
 specified as
 .B \-f
@@ -53,7 +52,7 @@ The file name 
 .B \-
 means the standard input.
 Any
-.IR file
+.I file
 of the form
 .I var=value
 is treated as an assignment, not a filename,
@@ -70,12 +69,12 @@ any number of
 options may be present.
 The
 .B \-F
-.IR fs
+.I fs
 option defines the input field separator to be the regular expression
-.IR fs.
+.IR fs .
 .PP
 An input line is normally made up of fields separated by white space,
-or by regular expression
+or by the regular expression
 .BR FS .
 The fields are denoted
 .BR $1 ,
@@ -87,7 +86,7 @@ If
 .BR FS
 is null, the input line is split into one field per character.
 .PP
-A pattern-action statement has the form
+A pattern-action statement has the form:
 .IP
 .IB pattern " { " action " }
 .PP
@@ -101,7 +100,7 @@ An action is a sequence of statements.
 A statement can be one of the following:
 .PP
 .EX
-.ta \w'\f(CWdelete array[expression]'u
+.ta \w'\f(CWdelete array[expression]\fR'u
 .RS
 .nf
 .ft CW
@@ -145,7 +144,7 @@ The operators
 are also available in expressions.
 Variables may be scalars, array elements
 (denoted
-.IB x  [ i ] )
+.IB x  [ i ] \fR)
 or fields.
 Variables are initialized to the null string.
 Array subscripts may be any string,
@@ -161,11 +160,11 @@ The
 .B print
 statement prints its arguments on the standard output
 (or on a file if
-.BI > file
+.BI > " file
 or
-.BI >> file
+.BI >> " file
 is present or on a pipe if
-.BI | cmd
+.BI | " cmd
 is present), separated by the current output field separator,
 and terminated by the output record separator.
 .I file
@@ -176,9 +175,10 @@ identical string values in different statements denote
 the same open file.
 The
 .B printf
-statement formats its expression list according to the format
+statement formats its expression list according to the
+.I format
 (see
-.IR printf (3)) .
+.IR printf (3)).
 The built-in function
 .BI close( expr )
 closes the file or pipe
@@ -189,13 +189,13 @@ flushes any buffered output for the file or pipe
 .IR expr .
 .PP
 The mathematical functions
+.BR atan2 ,
+.BR cos ,
 .BR exp ,
 .BR log ,
-.BR sqrt ,
 .BR sin ,
-.BR cos ,
 and
-.BR atan2 
+.B sqrt
 are built in.
 Other built-in functions:
 .TF length
@@ -203,7 +203,8 @@ Other built-in functions:
 .B length
 the length of its argument
 taken as a string,
-or of
+number of elements in an array for an array argument,
+or length of
 .B $0
 if no argument.
 .TP
@@ -218,14 +219,18 @@ and returns the previous seed.
 .B int
 truncates to an integer value
 .TP
-.BI substr( s , " m" , " n\fB)
+\fBsubstr(\fIs\fB, \fIm\fR [\fB, \fIn\^\fR]\fB)\fR
 the
 .IR n -character
 substring of
 .I s
 that begins at position
-.IR m 
+.I m 
 counted from 1.
+If no
+.IR m ,
+use the rest of the string
+.I 
 .TP
 .BI index( s , " t" )
 the position in
@@ -246,14 +251,14 @@ and
 .B RLENGTH
 are set to the position and length of the matched string.
 .TP
-.BI split( s , " a" , " fs\fB)
+\fBsplit(\fIs\fB, \fIa \fR[\fB, \fIfs\^\fR]\fB)\fR
 splits the string
 .I s
 into array elements
-.IB a [1] ,
-.IB a [2] ,
+.IB a [1] \fR,
+.IB a [2] \fR,
 \&...,
-.IB a [ n ] ,
+.IB a [ n ] \fR,
 and returns
 .IR n .
 The separation is done with the regular expression
@@ -266,7 +271,7 @@ is not given.
 An empty string as field separator splits the string
 into one array element per character.
 .TP
-.BI sub( r , " t" , " s\fB)
+\fBsub(\fIr\fB, \fIt \fR[, \fIs\^\fR]\fB)
 substitutes
 .I t
 for the first occurrence of the regular expression
@@ -279,7 +284,7 @@ is not given,
 .B $0
 is used.
 .TP
-.B gsub
+\fBgsub(\fIr\fB, \fIt \fR[, \fIs\^\fR]\fB)
 same as
 .B sub
 except that all occurrences of the regular expression
@@ -289,18 +294,28 @@ and
 .B gsub
 return the number of replacements.
 .TP
-.BI sprintf( fmt , " expr" , " ...\fB )
+.BI sprintf( fmt , " expr" , " ...\fB)
 the string resulting from formatting
 .I expr ...
 according to the
 .IR printf (3)
 format
-.I fmt
+.IR fmt .
 .TP
 .BI system( cmd )
 executes
 .I cmd
-and returns its exit status
+and returns its exit status. This will be \-1 upon error,
+.IR cmd 's
+exit status upon a normal exit,
+256 + 
+.I sig
+upon death-by-signal, where
+.I sig
+is the number of the murdering signal,
+or 512 +
+.I sig
+if there was a core dump.
 .TP
 .BI tolower( str )
 returns a copy of
@@ -321,7 +336,7 @@ sets
 .B $0
 to the next input record from the current input file;
 .B getline
-.BI < file
+.BI < " file
 sets
 .B $0
 to the next record from
@@ -359,7 +374,7 @@ Isolated regular expressions
 in a pattern apply to the entire line.
 Regular expressions may also occur in
 relational expressions, using the operators
-.BR ~
+.B ~
 and
 .BR !~ .
 .BI / re /
@@ -383,8 +398,12 @@ A relational expression is one of the following:
 .br
 .BI ( expr , expr,... ") in " array-name
 .PP
-where a relop is any of the six relational operators in C,
-and a matchop is either
+where a
+.I relop
+is any of the six relational operators in C,
+and a
+.I matchop
+is either
 .B ~
 (matches)
 or
@@ -405,57 +424,68 @@ and after the last.
 and
 .B END
 do not combine with other patterns.
+They may appear multiple times in a program and execute
+in the order they are read by
+.IR awk .
 .PP
 Variable names with special meanings:
 .TF FILENAME
 .TP
+.B ARGC
+argument count, assignable.
+.TP
+.B ARGV
+argument array, assignable;
+non-null members are taken as filenames.
+.TP
 .B CONVFMT
 conversion format used when converting numbers
 (default
-.BR "%.6g" )
+.BR "%.6g" ).
 .TP
+.B ENVIRON
+array of environment variables; subscripts are names.
+.TP
+.B FILENAME
+the name of the current input file.
+.TP
+.B FNR
+ordinal number of the current record in the current file.
+.TP
 .B FS
 regular expression used to separate fields; also settable
 by option
-.BI \-F fs.
+.BI \-F fs\fR.
 .TP
 .BR NF
-number of fields in the current record
+number of fields in the current record.
 .TP
 .B NR
-ordinal number of the current record
+ordinal number of the current record.
 .TP
-.B FNR
-ordinal number of the current record in the current file
+.B OFMT
+output format for numbers (default
+.BR "%.6g" ).
 .TP
-.B FILENAME
-the name of the current input file
-.TP
-.B RS
-input record separator (default newline)
-.TP
 .B OFS
-output field separator (default blank)
+output field separator (default space).
 .TP
 .B ORS
-output record separator (default newline)
+output record separator (default newline).
 .TP
-.B OFMT
-output format for numbers (default
-.BR "%.6g" )
+.B RLENGTH
+the length of a string matched by
+.BR match .
 .TP
-.B SUBSEP
-separates multiple subscripts (default 034)
+.B RS
+input record separator (default newline).
 .TP
-.B ARGC
-argument count, assignable
+.B RSTART
+the start position of a string matched by
+.BR match .
 .TP
-.B ARGV
-argument array, assignable;
-non-null members are taken as filenames
-.TP
-.B ENVIRON
-array of environment variables; subscripts are names.
+.B SUBSEP
+separates multiple subscripts (default 034).
 .PD
 .PP
 Functions may be defined (at the position of a pattern-action statement) thus:
@@ -486,7 +516,7 @@ BEGIN { FS = ",[ \et]*|[ \et]+" }
 .EE
 .ns
 .IP
-Same, with input fields separated by comma and/or blanks and tabs.
+Same, with input fields separated by comma and/or spaces and tabs.
 .PP
 .EX
 .nf
@@ -512,13 +542,13 @@ BEGIN	{	# Simulate echo(1)
 .fi
 .EE
 .SH SEE ALSO
+.IR grep (1), 
 .IR lex (1), 
 .IR sed (1)
 .br
 A. V. Aho, B. W. Kernighan, P. J. Weinberger,
-.I
-The AWK Programming Language,
-Addison-Wesley, 1988.  ISBN 0-201-07981-X
+.IR "The AWK Programming Language" ,
+Addison-Wesley, 1988.  ISBN 0-201-07981-X.
 .SH BUGS
 There are no explicit conversions between numbers and strings.
 To force an expression to be treated as a number add 0 to it;
@@ -527,3 +557,5 @@ to force it to be treated as a string concatenate
 .br
 The scope rules for variables in functions are a botch;
 the syntax is worse.
+.br
+Only eight-bit characters sets are handled correctly.

Modified: vendor/one-true-awk/dist/awk.h
==============================================================================
--- vendor/one-true-awk/dist/awk.h	Sun Jun  2 04:04:21 2019	(r348504)
+++ vendor/one-true-awk/dist/awk.h	Sun Jun  2 04:23:56 2019	(r348505)
@@ -81,7 +81,8 @@ typedef struct Cell {
 	char	*nval;		/* name, for variables only */
 	char	*sval;		/* string value */
 	Awkfloat fval;		/* value as number */
-	int	 tval;		/* type info: STR|NUM|ARR|FCN|FLD|CON|DONTFREE */
+	int	 tval;		/* type info: STR|NUM|ARR|FCN|FLD|CON|DONTFREE|CONVC|CONVO */
+	char	*fmt;		/* CONVFMT/OFMT value used to convert from number */
 	struct Cell *cnext;	/* ptr to next if chained */
 } Cell;
 
@@ -96,9 +97,14 @@ extern Array	*symtab;
 
 extern Cell	*nrloc;		/* NR */
 extern Cell	*fnrloc;	/* FNR */
+extern Cell	*fsloc;		/* FS */
 extern Cell	*nfloc;		/* NF */
+extern Cell	*ofsloc;	/* OFS */
+extern Cell	*orsloc;	/* ORS */
+extern Cell	*rsloc;		/* RS */
 extern Cell	*rstartloc;	/* RSTART */
 extern Cell	*rlengthloc;	/* RLENGTH */
+extern Cell	*subseploc;	/* SUBSEP */
 
 /* Cell.tval values: */
 #define	NUM	01	/* number value is valid */
@@ -109,6 +115,8 @@ extern Cell	*rlengthloc;	/* RLENGTH */
 #define	FCN	040	/* this is a function name */
 #define FLD	0100	/* this is a field $1, $2, ... */
 #define	REC	0200	/* this is $0 */
+#define CONVC	0400	/* string was converted from number via CONVFMT */
+#define CONVO	01000	/* string was converted from number via OFMT */
 
 
 /* function types */

Modified: vendor/one-true-awk/dist/awkgram.y
==============================================================================
--- vendor/one-true-awk/dist/awkgram.y	Sun Jun  2 04:04:21 2019	(r348504)
+++ vendor/one-true-awk/dist/awkgram.y	Sun Jun  2 04:23:56 2019	(r348505)
@@ -86,7 +86,7 @@ Node	*arglist = 0;	/* list of args for current functio
 %left	CAT
 %left	'+' '-'
 %left	'*' '/' '%'
-%left	NOT UMINUS
+%left	NOT UMINUS UPLUS
 %right	POWER
 %right	DECR INCR
 %left	INDIRECT
@@ -357,7 +357,7 @@ term:
 	| term '%' term			{ $$ = op2(MOD, $1, $3); }
 	| term POWER term		{ $$ = op2(POWER, $1, $3); }
 	| '-' term %prec UMINUS		{ $$ = op1(UMINUS, $2); }
-	| '+' term %prec UMINUS		{ $$ = $2; }
+	| '+' term %prec UMINUS		{ $$ = op1(UPLUS, $2); }
 	| NOT term %prec UMINUS		{ $$ = op1(NOT, notnull($2)); }
 	| BLTIN '(' ')'			{ $$ = op2(BLTIN, itonp($1), rectonode()); }
 	| BLTIN '(' patlist ')'		{ $$ = op2(BLTIN, itonp($1), $3); }

Modified: vendor/one-true-awk/dist/b.c
==============================================================================
--- vendor/one-true-awk/dist/b.c	Sun Jun  2 04:04:21 2019	(r348504)
+++ vendor/one-true-awk/dist/b.c	Sun Jun  2 04:23:56 2019	(r348505)
@@ -27,6 +27,7 @@ THIS SOFTWARE.
 #define	DEBUG
 
 #include <ctype.h>
+#include <limits.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -65,6 +66,11 @@ int	rlxval;
 static uschar	*rlxstr;
 static uschar	*prestr;	/* current position in current re */
 static uschar	*lastre;	/* origin of last re */
+static uschar	*lastatom;	/* origin of last Atom */
+static uschar	*starttok;
+static uschar 	*basestr;	/* starts with original, replaced during
+				   repetition processing */
+static uschar 	*firstbasestr;
 
 static	int setcnt;
 static	int poscnt;
@@ -82,11 +88,11 @@ fa *makedfa(const char *s, int anchor)	/* returns dfa 
 	fa *pfa;
 	static int now = 1;
 
-	if (setvec == NULL) {	/* first time through any RE */
+	if (setvec == 0) {	/* first time through any RE */
 		maxsetvec = MAXLIN;
 		setvec = (int *) malloc(maxsetvec * sizeof(int));
 		tmpset = (int *) malloc(maxsetvec * sizeof(int));
-		if (setvec == NULL || tmpset == NULL)
+		if (setvec == 0 || tmpset == 0)
 			overflo("out of space initializing makedfa");
 	}
 
@@ -124,6 +130,8 @@ fa *mkdfa(const char *s, int anchor)	/* does the real 
 	Node *p, *p1;
 	fa *f;
 
+	firstbasestr = (uschar *) s;
+	basestr = firstbasestr;
 	p = reparse(s);
 	p1 = op2(CAT, op2(STAR, op2(ALL, NIL, NIL), NIL), p);
 		/* put ALL STAR in front of reg.  exp. */
@@ -137,7 +145,7 @@ fa *mkdfa(const char *s, int anchor)	/* does the real 
 	f->accept = poscnt-1;	/* penter has computed number of positions in re */
 	cfoll(f, p1);	/* set up follow sets */
 	freetr(p1);
-	if ((f->posns[0] = (int *) calloc(*(f->re[0].lfollow), sizeof(int))) == NULL)
+	if ((f->posns[0] = (int *) calloc(1, *(f->re[0].lfollow)*sizeof(int))) == NULL)
 			overflo("out of space in makedfa");
 	if ((f->posns[1] = (int *) calloc(1, sizeof(int))) == NULL)
 		overflo("out of space in makedfa");
@@ -145,6 +153,10 @@ fa *mkdfa(const char *s, int anchor)	/* does the real 
 	f->initstat = makeinit(f, anchor);
 	f->anchor = anchor;
 	f->restr = (uschar *) tostring(s);
+	if (firstbasestr != basestr) {
+		if (basestr)
+			xfree(basestr);
+	}
 	return f;
 }
 
@@ -157,7 +169,7 @@ int makeinit(fa *f, int anchor)
 	f->reset = 0;
 	k = *(f->re[0].lfollow);
 	xfree(f->posns[2]);			
-	if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL)
+	if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL)
 		overflo("out of space in makeinit");
 	for (i=0; i <= k; i++) {
 		(f->posns[2])[i] = (f->re[0].lfollow)[i];
@@ -290,11 +302,11 @@ char *cclenter(const char *argp)	/* add a character cl
 	int i, c, c2;
 	uschar *p = (uschar *) argp;
 	uschar *op, *bp;
-	static uschar *buf = NULL;
+	static uschar *buf = 0;
 	static int bufsz = 100;
 
 	op = p;
-	if (buf == NULL && (buf = (uschar *) malloc(bufsz)) == NULL)
+	if (buf == 0 && (buf = (uschar *) malloc(bufsz)) == NULL)
 		FATAL("out of space for character class [%.10s...] 1", p);
 	bp = buf;
 	for (i = 0; (c = *p++) != 0; ) {
@@ -350,14 +362,14 @@ void cfoll(fa *f, Node *v)	/* enter follow set of each
 			maxsetvec *= 4;
 			setvec = (int *) realloc(setvec, maxsetvec * sizeof(int));
 			tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int));
-			if (setvec == NULL || tmpset == NULL)
+			if (setvec == 0 || tmpset == 0)
 				overflo("out of space in cfoll()");
 		}
 		for (i = 0; i <= f->accept; i++)
 			setvec[i] = 0;
 		setcnt = 0;
 		follow(v);	/* computes setvec and setcnt */
-		if ((p = (int *) calloc(setcnt+1, sizeof(int))) == NULL)
+		if ((p = (int *) calloc(1, (setcnt+1)*sizeof(int))) == NULL)
 			overflo("out of space building follow set");
 		f->re[info(v)].lfollow = p;
 		*p = setcnt;
@@ -391,7 +403,7 @@ int first(Node *p)	/* collects initially active leaves
 			maxsetvec *= 4;
 			setvec = (int *) realloc(setvec, maxsetvec * sizeof(int));
 			tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int));
-			if (setvec == NULL || tmpset == NULL)
+			if (setvec == 0 || tmpset == 0)
 				overflo("out of space in first()");
 		}
 		if (type(p) == EMPTYRE) {
@@ -531,7 +543,7 @@ int pmatch(fa *f, const char *p0)	/* longest match, fo
 			for (i = 2; i <= f->curstat; i++)
 				xfree(f->posns[i]);
 			k = *f->posns[0];			
-			if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL)
+			if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL)
 				overflo("out of space in pmatch");
 			for (i = 0; i <= k; i++)
 				(f->posns[2])[i] = (f->posns[0])[i];
@@ -588,7 +600,7 @@ int nematch(fa *f, const char *p0)	/* non-empty match,
 			for (i = 2; i <= f->curstat; i++)
 				xfree(f->posns[i]);
 			k = *f->posns[0];			
-			if ((f->posns[2] = (int *) calloc(k+1, sizeof(int))) == NULL)
+			if ((f->posns[2] = (int *) calloc(1, (k+1)*sizeof(int))) == NULL)
 				overflo("out of state space");

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list