grep -i does not work for simple patterns and single byte locales, like

LANG=ru_RU.KOI8-R grep -i <some single KOI8-R letter>
Fix it.

MFC after:      3 days
This commit is contained in:
Andrey A. Chernov 2013-07-30 18:16:43 +00:00
parent 7263f45e6f
commit f1135552c6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253810

View File

@ -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;
}