From 9b19835bd4027407f209bdd92f57c727d96ff4df Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Thu, 26 May 2022 20:23:11 +0000 Subject: [PATCH] tmparse: remove incorrect isalpha definition Checking the range of c|0x60 incorrectly classifies many characters as alphabetic (digits, control characters 0x01-0x20, and punctuation characters '!'-':'). This prevents tmparse from parsing dates with a timezone bounded by those characters (for example, "12:11:56 (PDT)"). Instead, just reuse the isalpha macro provided by ctype.h. --- sys/src/libc/port/date.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/src/libc/port/date.c b/sys/src/libc/port/date.c index 805302432..c9526dec6 100644 --- a/sys/src/libc/port/date.c +++ b/sys/src/libc/port/date.c @@ -1,5 +1,6 @@ #include #include +#include typedef struct Tzabbrev Tzabbrev; typedef struct Tzoffpair Tzoffpair; @@ -62,9 +63,6 @@ struct Tzoffpair { int off; }; -#define isalpha(c)\ - (((c)|0x60) >= 'a' && ((c)|0x60) <= 'z') - /* Obsolete time zone names. Hardcoded to match RFC5322 */ static Tzabbrev tzabbrev[] = { {"UT", "GMT"}, {"GMT", "GMT"}, {"UTC", "GMT"},