From 68f09677b7aaedafa8c29280ccd76a034fe269f1 Mon Sep 17 00:00:00 2001
From: Debian <debian>
Date: Sun, 23 Nov 2008 17:28:46 +0100
Subject: [PATCH] Case-insensitive list matching fix
This fixes case-insensitive matching of lists in multi-byte character sets.
Original comment:
fix the following problem in multibyte locales.
% echo Y | egrep -i '[y]'
%
derived from gawk's dfa.c.
Original ticket: https://bugzilla.redhat.com/show_bug.cgi?id=123363
Debian: 61-dfa.c-case_fold-charclass.patch
---
src/dfa.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/src/dfa.c b/src/dfa.c
index 934be97..088c379 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -689,6 +689,20 @@ parse_bracket_exp_mb ()
REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al,
work_mbc->nchars + 1);
work_mbc->chars[work_mbc->nchars++] = (wchar_t)wc;
+ if (case_fold && (iswlower((wint_t) wc) || iswupper((wint_t) wc)))
+ {
+ wint_t altcase;
+
+ altcase = wc; /* keeps compiler happy */
+ if (iswlower((wint_t) wc))
+ altcase = towupper((wint_t) wc);
+ else if (iswupper((wint_t) wc))
+ altcase = towlower((wint_t) wc);
+
+ REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al,
+ work_mbc->nchars + 1);
+ work_mbc->chars[work_mbc->nchars++] = (wchar_t) altcase;
+ }
}
}
while ((wc = wc1) != L']');
--
1.5.5.1