diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-07-13 12:11:04 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-07-13 12:11:04 +0300 |
commit | 4fe1f4ac1aa0e4b99c9abb26794fc0d10ebb77c6 (patch) | |
tree | fcbe1c1dffa7ce2c913844b243265d853f92253a /test/getline5.awk | |
parent | c494c33d585d0b7498b8e368434f60f2c107497f (diff) | |
download | egawk-4fe1f4ac1aa0e4b99c9abb26794fc0d10ebb77c6.tar.gz egawk-4fe1f4ac1aa0e4b99c9abb26794fc0d10ebb77c6.tar.bz2 egawk-4fe1f4ac1aa0e4b99c9abb26794fc0d10ebb77c6.zip |
Doc update and new test on getline with side effects.
Diffstat (limited to 'test/getline5.awk')
-rw-r--r-- | test/getline5.awk | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/getline5.awk b/test/getline5.awk new file mode 100644 index 00000000..4757bcfe --- /dev/null +++ b/test/getline5.awk @@ -0,0 +1,35 @@ +# Message-ID: <4F7832BD.9030709@gmx.com> +# Date: Sun, 01 Apr 2012 11:49:33 +0100 +# From: Duncan Moore <duncan.moore@gmx.com> +# To: "bug-gawk@gnu.org" <bug-gawk@gnu.org> +# Subject: [bug-gawk] getline difference from gawk versions >=4.0.0 +# +# Hi +# +# b.awk: +# +# BEGIN { +# system("echo 1 > f") +# while ((getline a[++c] < "f") > 0) {} +# print c +# } +# +# gawk -f b.awk +# +# Prior to gawk 4.0.0 this outputs: +# +# 1 +# +# For 4.0.0 and 4.0.1 it outputs: +# +# 2 +# +# Regards +# Duncan Moore + +BEGIN { + system("echo 1 > f") + while ((getline a[++c] < "f") > 0) {} + print c + system("rm -f f") +} |