Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/nvi/dist PR/52671: Ralph Geier: The ignorecase ...



details:   https://anonhg.NetBSD.org/src/rev/2e0fa39e745c
branches:  trunk
changeset: 827472:2e0fa39e745c
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Oct 29 15:29:34 2017 +0000

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

diffstat:

 external/bsd/nvi/dist/common/multibyte.h |   4 +++-
 external/bsd/nvi/dist/regex/regcomp.c    |  20 ++++++++++----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diffs (87 lines):

diff -r 06af6a1667a6 -r 2e0fa39e745c external/bsd/nvi/dist/common/multibyte.h
--- a/external/bsd/nvi/dist/common/multibyte.h  Sun Oct 29 15:00:00 2017 +0000
+++ b/external/bsd/nvi/dist/common/multibyte.h  Sun Oct 29 15:29:34 2017 +0000
@@ -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 @@
 #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 @@
 #define ISCNTRL                iscntrl
 #define ISGRAPH                isgraph
 #define ISLOWER                islower
+#define ISALPHA2       isalpha
 #define ISPUNCT                ispunct
 #define ISSPACE                isspace
 #define ISUPPER                isupper
diff -r 06af6a1667a6 -r 2e0fa39e745c external/bsd/nvi/dist/regex/regcomp.c
--- a/external/bsd/nvi/dist/regex/regcomp.c     Sun Oct 29 15:00:00 2017 +0000
+++ b/external/bsd/nvi/dist/regex/regcomp.c     Sun Oct 29 15:29:34 2017 +0000
@@ -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 @@
                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 @@
        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 @@
 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 @@
        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);



Home | Main Index | Thread Index | Old Index