PR/52671: Ralph Geier: The ignorecase option is not handeled correctly in vi

for unicode characters
This commit is contained in:
christos 2017-10-29 15:29:34 +00:00
parent f7148f3c1a
commit 925cb01a3f
2 changed files with 13 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: multibyte.h,v 1.2 2013/11/22 15:52:05 christos Exp $ */
/* $NetBSD: multibyte.h,v 1.3 2017/10/29 15:29:34 christos Exp $ */
#ifndef MULTIBYTE_H
#define MULTIBYTE_H
@ -53,6 +53,7 @@ typedef wint_t UCHAR_T;
#define ISCNTRL iswcntrl
#define ISGRAPH iswgraph
#define ISLOWER iswlower
#define ISALPHA2 iswalpha
#define ISPUNCT iswpunct
#define ISSPACE iswspace
#define ISUPPER iswupper
@ -86,6 +87,7 @@ typedef unsigned char UCHAR_T;
#define ISCNTRL iscntrl
#define ISGRAPH isgraph
#define ISLOWER islower
#define ISALPHA2 isalpha
#define ISPUNCT ispunct
#define ISSPACE isspace
#define ISUPPER isupper

View File

@ -1,4 +1,4 @@
/* $NetBSD: regcomp.c,v 1.5 2014/01/26 21:47:00 christos Exp $ */
/* $NetBSD: regcomp.c,v 1.6 2017/10/29 15:29:34 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994 Henry Spencer.
* Copyright (c) 1992, 1993, 1994
@ -44,7 +44,7 @@
static char sccsid[] = "@(#)regcomp.c 8.4 (Berkeley) 3/19/94";
#endif /* LIBC_SCCS and not lint */
#else
__RCSID("$NetBSD: regcomp.c,v 1.5 2014/01/26 21:47:00 christos Exp $");
__RCSID("$NetBSD: regcomp.c,v 1.6 2017/10/29 15:29:34 christos Exp $");
#endif
#include <sys/types.h>
@ -752,7 +752,7 @@ p_bracket(struct parse *p)
int ci;
for (i = p->g->csetsize - 1; i >= 0; i--)
if (CHIN(cs, i) && isalpha(i)) {
if (CHIN(cs, i) && ISALPHA2(i)) {
ci = othercase(i);
if (ci != i)
CHadd(cs, ci);
@ -860,7 +860,7 @@ p_b_cclass(struct parse *p, cset *cs)
const char *u;
char c;
while (MORE() && isalpha(PEEK()))
while (MORE() && ISALPHA2(PEEK()))
NEXT();
len = p->next - sp;
for (cp = cclasses; cp->name != NULL; cp++)
@ -949,11 +949,11 @@ p_b_coll_elem(struct parse *p, int endc)
static char /* if no counterpart, return ch */
othercase(int ch)
{
assert(isalpha(ch));
if (isupper(ch))
return(tolower(ch));
else if (islower(ch))
return(toupper(ch));
assert(ISALPHA2(ch));
if (ISUPPER(ch))
return(TOLOWER(ch));
else if (ISLOWER(ch))
return(TOUPPER(ch));
else /* peculiar, but could happen */
return(ch);
}
@ -994,7 +994,7 @@ ordinary(struct parse *p, int ch)
cat_t *cap = p->g->categories;
*/
if ((p->g->cflags&REG_ICASE) && isalpha(ch) && othercase(ch) != ch)
if ((p->g->cflags&REG_ICASE) && ISALPHA2(ch) && othercase(ch) != ch)
bothcases(p, ch);
else {
EMIT(OCHAR, (UCHAR_T)ch);