Module Name: src Committed By: snj Date: Sat Jan 9 01:53:04 UTC 2010
Modified Files: src/dist/nvi/common [netbsd-5]: cut.c cut.h multibyte.h src/dist/nvi/ex [netbsd-5]: ex.c ex_subst.c ex_usage.c src/dist/nvi/vi [netbsd-5]: v_ulcase.c Log Message: Pull up following revision(s) (requested by mlelstv in ticket #1224): dist/nvi/common/cut.c: revision 1.3 dist/nvi/common/cut.h: revision 1.3 dist/nvi/common/multibyte.h: revision 1.5 dist/nvi/ex/ex.c: revision 1.6 dist/nvi/ex/ex_subst.c: revision 1.3 dist/nvi/ex/ex_usage.c: revision 1.4 via patch dist/nvi/vi/v_ulcase.c: revision 1.2 Use wide char versions of tolower/toupper/islower/isupper where appropriate. Fixes ~ command on big-endian architectures. To generate a diff of this commit: cvs rdiff -u -r1.1.1.2.6.1 -r1.1.1.2.6.2 src/dist/nvi/common/cut.c \ src/dist/nvi/common/cut.h cvs rdiff -u -r1.1.1.2.6.3 -r1.1.1.2.6.4 src/dist/nvi/common/multibyte.h cvs rdiff -u -r1.1.1.2.6.2 -r1.1.1.2.6.3 src/dist/nvi/ex/ex.c cvs rdiff -u -r1.1.1.2.6.1 -r1.1.1.2.6.2 src/dist/nvi/ex/ex_subst.c \ src/dist/nvi/ex/ex_usage.c cvs rdiff -u -r1.1.1.2 -r1.1.1.2.6.1 src/dist/nvi/vi/v_ulcase.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/dist/nvi/common/cut.c diff -u src/dist/nvi/common/cut.c:1.1.1.2.6.1 src/dist/nvi/common/cut.c:1.1.1.2.6.2 --- src/dist/nvi/common/cut.c:1.1.1.2.6.1 Tue Jan 20 02:41:11 2009 +++ src/dist/nvi/common/cut.c Sat Jan 9 01:53:03 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: cut.c,v 1.1.1.2.6.1 2009/01/20 02:41:11 snj Exp $ */ +/* $NetBSD: cut.c,v 1.1.1.2.6.2 2010/01/09 01:53:03 snj Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -103,10 +103,10 @@ copy_one = 1; cb_rotate(sp); } - if ((append = isupper(name)) == 1) { + if ((append = ISUPPER(name)) == 1) { if (!copy_one) copy_def = 1; - name = tolower(name); + name = TOLOWER(name); } namecb: CBNAME(sp, cbp, name); } else if (LF_ISSET(CUT_NUMREQ) || (LF_ISSET(CUT_NUMOPT) && Index: src/dist/nvi/common/cut.h diff -u src/dist/nvi/common/cut.h:1.1.1.2.6.1 src/dist/nvi/common/cut.h:1.1.1.2.6.2 --- src/dist/nvi/common/cut.h:1.1.1.2.6.1 Tue Jan 20 02:41:11 2009 +++ src/dist/nvi/common/cut.h Sat Jan 9 01:53:03 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: cut.h,v 1.1.1.2.6.1 2009/01/20 02:41:11 snj Exp $ */ +/* $NetBSD: cut.h,v 1.1.1.2.6.2 2010/01/09 01:53:03 snj Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -67,8 +67,8 @@ */ #define CBNAME(sp, cbp, nch) { \ CHAR_T L__name; \ - L__name = isupper((unsigned char)nch) ? \ - tolower((unsigned char)nch) : (nch); \ + L__name = ISUPPER((unsigned char)nch) ? \ + TOLOWER((unsigned char)nch) : (nch); \ for (cbp = sp->wp->cutq.lh_first; \ cbp != NULL; cbp = cbp->q.le_next) \ if (cbp->name == L__name) \ Index: src/dist/nvi/common/multibyte.h diff -u src/dist/nvi/common/multibyte.h:1.1.1.2.6.3 src/dist/nvi/common/multibyte.h:1.1.1.2.6.4 --- src/dist/nvi/common/multibyte.h:1.1.1.2.6.3 Sun Oct 18 09:58:03 2009 +++ src/dist/nvi/common/multibyte.h Sat Jan 9 01:53:03 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: multibyte.h,v 1.1.1.2.6.3 2009/10/18 09:58:03 sborrill Exp $ */ +/* $NetBSD: multibyte.h,v 1.1.1.2.6.4 2010/01/09 01:53:03 snj Exp $ */ #ifndef MULTIBYTE_H #define MULTIBYTE_H @@ -23,6 +23,9 @@ #define STRCMP wcscmp #define STRPBRK wcspbrk #define TOUPPER towupper +#define TOLOWER towlower +#define ISUPPER iswupper +#define ISLOWER iswlower #define STRSET wmemset #define STRCHR wcschr @@ -41,6 +44,9 @@ #define STRCMP strcmp #define STRPBRK strpbrk #define TOUPPER toupper +#define TOLOWER tolower +#define ISUPPER isupper +#define ISLOWER islower #define STRSET memset #define STRCHR strchr Index: src/dist/nvi/ex/ex.c diff -u src/dist/nvi/ex/ex.c:1.1.1.2.6.2 src/dist/nvi/ex/ex.c:1.1.1.2.6.3 --- src/dist/nvi/ex/ex.c:1.1.1.2.6.2 Tue Jan 20 03:01:03 2009 +++ src/dist/nvi/ex/ex.c Sat Jan 9 01:53:03 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ex.c,v 1.1.1.2.6.2 2009/01/20 03:01:03 snj Exp $ */ +/* $NetBSD: ex.c,v 1.1.1.2.6.3 2010/01/09 01:53:03 snj Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -438,7 +438,7 @@ break; case 'E': case 'F': case 'N': case 'P': case 'T': case 'V': newscreen = 1; - p[0] = tolower(p[0]); + p[0] = TOLOWER(p[0]); break; } @@ -486,7 +486,7 @@ /* FALLTHROUGH */ default: unknown: if (newscreen) - p[0] = toupper(p[0]); + p[0] = TOUPPER(p[0]); ex_unknown(sp, p, namelen); goto err; } Index: src/dist/nvi/ex/ex_subst.c diff -u src/dist/nvi/ex/ex_subst.c:1.1.1.2.6.1 src/dist/nvi/ex/ex_subst.c:1.1.1.2.6.2 --- src/dist/nvi/ex/ex_subst.c:1.1.1.2.6.1 Tue Jan 20 02:41:12 2009 +++ src/dist/nvi/ex/ex_subst.c Sat Jan 9 01:53:03 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ex_subst.c,v 1.1.1.2.6.1 2009/01/20 02:41:12 snj Exp $ */ +/* $NetBSD: ex_subst.c,v 1.1.1.2.6.2 2010/01/09 01:53:03 snj Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -912,7 +912,7 @@ } if (LF_ISSET(SEARCH_ICL)) { iclower: for (p = ptrn, len = plen; len > 0; ++p, --len) - if (isupper(*p)) + if (ISUPPER(*p)) break; if (len == 0) reflags |= REG_ICASE; @@ -1366,15 +1366,15 @@ conv = C_NOT_SET; \ /* FALLTHROUGH */ \ case C_LOWER: \ - if (isupper(__ch)) \ - __ch = tolower(__ch); \ + if (ISUPPER(__ch)) \ + __ch = TOLOWER(__ch); \ break; \ case C_ONE_UPPER: \ conv = C_NOT_SET; \ /* FALLTHROUGH */ \ case C_UPPER: \ - if (islower(__ch)) \ - __ch = toupper(__ch); \ + if (ISLOWER(__ch)) \ + __ch = TOUPPER(__ch); \ break; \ default: \ abort(); \ Index: src/dist/nvi/ex/ex_usage.c diff -u src/dist/nvi/ex/ex_usage.c:1.1.1.2.6.1 src/dist/nvi/ex/ex_usage.c:1.1.1.2.6.2 --- src/dist/nvi/ex/ex_usage.c:1.1.1.2.6.1 Tue Jan 20 02:41:12 2009 +++ src/dist/nvi/ex/ex_usage.c Sat Jan 9 01:53:03 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ex_usage.c,v 1.1.1.2.6.1 2009/01/20 02:41:12 snj Exp $ */ +/* $NetBSD: ex_usage.c,v 1.1.1.2.6.2 2010/01/09 01:53:03 snj Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -68,9 +68,9 @@ switch (cmdp->argc) { case 1: ap = cmdp->argv[0]; - if (isupper(ap->bp[0])) { + if (ISUPPER(ap->bp[0])) { newscreen = 1; - ap->bp[0] = tolower(ap->bp[0]); + ap->bp[0] = TOLOWER(ap->bp[0]); } else newscreen = 0; for (cp = cmds; cp->name != NULL && @@ -78,7 +78,7 @@ if (cp->name == NULL || (newscreen && !F_ISSET(cp, E_NEWSCREEN))) { if (newscreen) - ap->bp[0] = toupper(ap->bp[0]); + ap->bp[0] = TOUPPER(ap->bp[0]); (void)ex_printf(sp, "The %.*s command is unknown\n", (int)ap->len, ap->bp); } else { Index: src/dist/nvi/vi/v_ulcase.c diff -u src/dist/nvi/vi/v_ulcase.c:1.1.1.2 src/dist/nvi/vi/v_ulcase.c:1.1.1.2.6.1 --- src/dist/nvi/vi/v_ulcase.c:1.1.1.2 Sun May 18 14:31:47 2008 +++ src/dist/nvi/vi/v_ulcase.c Sat Jan 9 01:53:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: v_ulcase.c,v 1.1.1.2 2008/05/18 14:31:47 aymeric Exp $ */ +/* $NetBSD: v_ulcase.c,v 1.1.1.2.6.1 2010/01/09 01:53:04 snj Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -155,12 +155,12 @@ change = rval = 0; for (p = bp + scno, t = bp + ecno + 1; p < t; ++p) { - ch = *(u_char *)p; - if (islower(ch)) { - *p = toupper(ch); + ch = *p; + if (ISLOWER(ch)) { + *p = TOUPPER(ch); change = 1; - } else if (isupper(ch)) { - *p = tolower(ch); + } else if (ISUPPER(ch)) { + *p = TOLOWER(ch); change = 1; } }