summaryrefslogtreecommitdiff
path: root/test/rsgetline.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-05-09 11:59:29 +0300
committerArnold D. Robbins <arnold@skeeve.com>2014-05-09 11:59:29 +0300
commit40694fc1c11bae6fac8e809a6a4c161c12cc37b7 (patch)
tree0b7858a44f30c13c0fd0da1423ea965c6b9240b6 /test/rsgetline.awk
parent12857707435f1d4bf9adf33b6fbfd57ff91529a7 (diff)
downloadgawk-40694fc1c11bae6fac8e809a6a4c161c12cc37b7.tar.gz
Fix in read_a_record for short file with RS=regex.
Diffstat (limited to 'test/rsgetline.awk')
-rw-r--r--test/rsgetline.awk23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/rsgetline.awk b/test/rsgetline.awk
new file mode 100644
index 00000000..fa327fcf
--- /dev/null
+++ b/test/rsgetline.awk
@@ -0,0 +1,23 @@
+# Date: Sun, 4 May 2014 18:09:01 +0200
+# From: Davide Brini <dave_br@gmx.com>
+# To: bug-gawk@gnu.org
+# Subject: Re: [bug-gawk] Computed regex and getline bug / issue
+#
+# I have been able to reduce the behavior to these simple test cases, which
+# (unless I'm missing something obvious) should behave identically but don't:
+#
+# $ printf '1,2,' | gawk 'BEGIN{RS="[,]+"}{print; a = getline; print "-"a"-"; print}'
+# 1
+# -0-
+# 1
+
+BEGIN {
+ RS = "[,]+"
+}
+
+{
+ printf "[%s] [%s]\n", $0, RT
+ a = getline
+ print "-"a"-"
+ printf "[%s] [%s]\n", $0, RT
+}