shithub: trueawk

Download patch

ref: 78c79c06d07735d5881ea08cf40e014a41d341af
parent: e2d71a98a4c901a4584d4565ae54a2a594def747
author: Arnold D. Robbins <arnold@skeeve.com>
date: Fri Jan 31 03:40:11 EST 2020

Fix a{0}, update tests.

--- a/FIXES
+++ b/FIXES
@@ -25,6 +25,11 @@
 This file lists all bug fixes, changes, etc., made since the AWK book
 was sent to the printers in August, 1987.
 
+January 31, 2020:
+	Merge PR #70, which avoids use of variable length arrays. Thanks
+	to GitHub user michaelforney.  Fix issue #60 ({0} in interval
+	expressions doesn't work). Thanks to Arnold Robbins.
+
 January 24, 2020:
 	A number of small cleanups from Christos Zoulas.  Add the close
 	on exec flag to files/pipes opened for redirection; courtesy of
@@ -77,13 +82,13 @@
 
 October 24, 2019:
 	Import second round of code cleanups from NetBSD. Much thanks
-	to Christos Zoulas (Github user zoulasc). Merges PR 53.
+	to Christos Zoulas (GitHub user zoulasc). Merges PR 53.
 	Add an optimization for string concatenation, also from
 	Christos.
 
 October 17, 2019:
 	Import code cleanups from NetBSD. Much thanks to Christos
-	Zoulas (Github user zoulasc). Merges PR 51.
+	Zoulas (GitHub user zoulasc). Merges PR 51.
 
 October 6, 2019:
 	Import code from NetBSD awk that implements RS as a regular
@@ -91,7 +96,7 @@
 
 September 10, 2019:
 	Fixes for various array / memory overruns found via gcc's
-	-fsanitize=unknown. Thanks to Alexander Richardson (Github
+	-fsanitize=unknown. Thanks to Alexander Richardson (GitHub
 	user arichardson). Merges PRs 47 and 48.
 
 July 28, 2019:
--- a/main.c
+++ b/main.c
@@ -22,7 +22,7 @@
 THIS SOFTWARE.
 ****************************************************************/
 
-const char	*version = "version 20200124";
+const char	*version = "version 20200131";
 
 #define DEBUG
 #include <stdio.h>
--- a/testdir/T.int-expr
+++ b/testdir/T.int-expr
@@ -18,6 +18,34 @@
 ac	1
 abc	0
 
+pat	a(b{0})c
+ac	1
+abc	0
+
+pat	ab{0}*c
+ac	1
+abc	0
+
+pat	a(b{0})*c
+ac	1
+abc	0
+
+pat	ab{0,}c
+ac	1
+abc	1
+
+pat	a(b{0,})c
+ac	1
+abc	1
+
+pat	ab{0,}*c
+ac	1
+abc	1
+
+pat	a(b{0,})*c
+ac	1
+abc	1
+
 pat	ab{1}c
 ac	0
 abc	1
@@ -53,6 +81,20 @@
 cat << \EOF > foo1
 ac ~ /ab{0}c/ -> should be 1, is 1
 abc ~ /ab{0}c/ -> should be 0, is 0
+ac ~ /a(b{0})c/ -> should be 1, is 1
+abc ~ /a(b{0})c/ -> should be 0, is 0
+ac ~ /ab{0}*c/ -> should be 1, is 1
+abc ~ /ab{0}*c/ -> should be 0, is 0
+ac ~ /a(b{0})*c/ -> should be 1, is 1
+abc ~ /a(b{0})*c/ -> should be 0, is 0
+ac ~ /ab{0,}c/ -> should be 1, is 1
+abc ~ /ab{0,}c/ -> should be 1, is 1
+ac ~ /a(b{0,})c/ -> should be 1, is 1
+abc ~ /a(b{0,})c/ -> should be 1, is 1
+ac ~ /ab{0,}*c/ -> should be 1, is 1
+abc ~ /ab{0,}*c/ -> should be 1, is 1
+ac ~ /a(b{0,})*c/ -> should be 1, is 1
+abc ~ /a(b{0,})*c/ -> should be 1, is 1
 ac ~ /ab{1}c/ -> should be 0, is 0
 abc ~ /ab{1}c/ -> should be 1, is 1
 abbc ~ /ab{1}c/ -> should be 0, is 0
--- a/testdir/T.misc
+++ b/testdir/T.misc
@@ -382,7 +382,7 @@
 		print "hello, world"
 	}
 }}}' >foo1 2>foo2
-grep 'source line 5' foo2 >/dev/null 2>&1 || echo 'BAD: T.misc continuation line number'
+grep 'source line 4' foo2 >/dev/null 2>&1 || echo 'BAD: T.misc continuation line number'
 
 
 echo 111 222 333 >foo
--