From 0cbd43fe09ae5eedb2ac56a8fd5c36cbe8257d3a Mon Sep 17 00:00:00 2001
From: Paul Ganssle <paul@ganssle.io>
Date: Fri, 20 Mar 2020 10:21:27 -0400
Subject: [PATCH] Fix warning message with non-alphanumerics

This change fixes the confusing error message raised when a
non-alphanumeric character occurs within the first 3 characters of a TZ
string abbreviation, e.g.:

$ zdump '=CST5'
=CST5  Fri Mar 20 09:26:54 2020 _CST
zdump: warning: zone "=CST5" abbreviation "_CST" has fewer than 3 characters
---
 zdump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/zdump.c b/zdump.c
index 0fc8ced..a5fdafe 100644
--- a/zdump.c
+++ b/zdump.c
@@ -328,7 +328,7 @@ abbrok(const char *const abbrp, const char *const zone)
 	cp = abbrp;
 	while (is_alpha(*cp) || is_digit(*cp) || *cp == '-' || *cp == '+')
 		++cp;
-	if (cp - abbrp < 3)
+	if (cp - abbrp < 3 && !*cp)
 	  wp = _("has fewer than 3 characters");
 	else if (cp - abbrp > 6)
 	  wp = _("has more than 6 characters");
-- 
2.25.1

