From d6abb7bc66d6cc78b74c70932177e31feed88a72 Mon Sep 17 00:00:00 2001 From: ache Date: Tue, 30 Jul 2013 18:16:43 +0000 Subject: grep -i does not work for simple patterns and single byte locales, like LANG=ru_RU.KOI8-R grep -i Fix it. MFC after: 3 days --- usr.bin/grep/regex/tre-fastmatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.bin/grep') diff --git a/usr.bin/grep/regex/tre-fastmatch.c b/usr.bin/grep/regex/tre-fastmatch.c index b7a7c91..4b58900 100644 --- a/usr.bin/grep/regex/tre-fastmatch.c +++ b/usr.bin/grep/regex/tre-fastmatch.c @@ -395,7 +395,7 @@ static int fastcmp(const fastmatch_t *fg, const void *data, if (p == NULL) \ return REG_ESPACE; \ for (unsigned int i = 0; i < plen; i++) \ - p[i] = tolower(pat[i]); \ + p[i] = tolower((unsigned char)pat[i]); \ _CALC_BMGS(arr, p, plen); \ xfree(p); \ } \ @@ -1030,7 +1030,7 @@ fastcmp(const fastmatch_t *fg, const void *data, tre_str_type_t type) continue; /* Compare */ - if (fg->icase ? (tolower(pat_byte[i]) == tolower(str_byte[i])) + if (fg->icase ? (tolower((unsigned char)pat_byte[i]) == tolower((unsigned char)str_byte[i])) : (pat_byte[i] == str_byte[i])) continue; } -- cgit v1.1