Module Name:    src
Committed By:   christos
Date:           Sun Oct 29 15:29:34 UTC 2017

Modified Files:
        src/external/bsd/nvi/dist/common: multibyte.h
        src/external/bsd/nvi/dist/regex: regcomp.c

Log Message:
PR/52671: Ralph Geier: The ignorecase option is not handeled correctly in vi
for unicode characters


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/nvi/dist/common/multibyte.h
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/regex/regcomp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/nvi/dist/common/multibyte.h
diff -u src/external/bsd/nvi/dist/common/multibyte.h:1.2 src/external/bsd/nvi/dist/common/multibyte.h:1.3
--- src/external/bsd/nvi/dist/common/multibyte.h:1.2	Fri Nov 22 10:52:05 2013
+++ src/external/bsd/nvi/dist/common/multibyte.h	Sun Oct 29 11:29:34 2017
@@ -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

Index: src/external/bsd/nvi/dist/regex/regcomp.c
diff -u src/external/bsd/nvi/dist/regex/regcomp.c:1.5 src/external/bsd/nvi/dist/regex/regcomp.c:1.6
--- src/external/bsd/nvi/dist/regex/regcomp.c:1.5	Sun Jan 26 16:47:00 2014
+++ src/external/bsd/nvi/dist/regex/regcomp.c	Sun Oct 29 11:29:34 2017
@@ -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);

Reply via email to