From 22875b5b069bb74b734dc7009e3dbadaff5a1904 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 21 Jan 2018 18:02:45 -0800
Subject: [PATCH] Port to mawk 1.3.3

Problem reported by Ohyama in:
https://mm.icann.org/pipermail/tz/2018-January/025904.html
* NEWS: Mention this.
* zishrink.awk: Avoid character class expressions like [:space:]
in regular expressions, as they do not work in mawk 1.3.3.
---
 NEWS         | 5 +++++
 zishrink.awk | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 54cfa7f..f1cf778 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,11 @@ Unreleased, experimental changes
     developed for ICU and OpenJDK.  (Problems reported by Deborah
     Goldsmith and Stephen Colebourne.)
 
+  Changes to build procedure
+
+    The build procedure now works around mawk 1.3.3's lack of support
+    for character class expressions.  (Problem reported by Ohyama.)
+
 
 Release 2018b - 2018-01-17 23:24:48 -0800
 
diff --git a/zishrink.awk b/zishrink.awk
index c629109..23d623e 100644
--- a/zishrink.awk
+++ b/zishrink.awk
@@ -37,7 +37,7 @@ function process_input_line(line, field, end, i, n, startdef)
   # Remove comments, normalize spaces, and append a space to each line.
   sub(/#.*/, "", line)
   line = line " "
-  gsub(/[[:space:]]+/, " ", line)
+  gsub(/[\f\r\t\v ]+/, " ", line)
 
   # Abbreviate keywords.  Do not abbreviate "Link" to just "L",
   # as pre-2017c zic erroneously diagnoses "Li" as ambiguous.
@@ -94,7 +94,7 @@ function process_input_line(line, field, end, i, n, startdef)
   sub(/ 0+$/, "", line)
 
   # Remove unnecessary trailing days-of-month "1".
-  if (match(line, /[[:alpha:]] 1$/))
+  if (match(line, /[A-Za-z] 1$/))
     line = substr(line, 1, RSTART)
 
   # Remove unnecessary trailing " Ja" (for January).
@@ -148,7 +148,7 @@ BEGIN {
   print "# This zic input file is in the public domain."
 }
 
-/^[[:space:]]*[^#[:space:]]/ {
+/^[\f\r\t\v ]*[^#\f\r\t\v ]/ {
   process_input_line($0)
 }
 
-- 
2.7.4

