From 63dd09a8c91fcf1f022506ffd9fcf02dcb61818b Mon Sep 17 00:00:00 2001 From: espie <> Date: Mon, 8 Aug 2005 05:53:01 +0000 Subject: activate LC_CTYPE for 8 bits locale. Make sure tolower/toupper use the whole 8 bits. okay deraadt@ thanks to everyone who tested --- src/lib/libc/include/ctype_private.h | 7 +++++++ src/lib/libc/string/wcscmp.c | 6 +++--- src/lib/libc/string/wcsncmp.c | 8 ++++---- src/lib/libc/string/wmemcmp.c | 8 ++++---- 4 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 src/lib/libc/include/ctype_private.h (limited to 'src/lib') diff --git a/src/lib/libc/include/ctype_private.h b/src/lib/libc/include/ctype_private.h new file mode 100644 index 0000000000..39cc792ea4 --- /dev/null +++ b/src/lib/libc/include/ctype_private.h @@ -0,0 +1,7 @@ +/* $OpenBSD: ctype_private.h,v 1.1 2005/08/08 05:53:00 espie Exp $ */ +/* Written by Marc Espie, public domain */ +#define CTYPE_NUM_CHARS 256 +extern const char _C_ctype_[]; +extern const short _C_toupper_[]; +extern const short _C_tolower_[]; + diff --git a/src/lib/libc/string/wcscmp.c b/src/lib/libc/string/wcscmp.c index d8a9aa73fb..ebbb87ca4d 100644 --- a/src/lib/libc/string/wcscmp.c +++ b/src/lib/libc/string/wcscmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wcscmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $ */ +/* $OpenBSD: wcscmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $ */ /* $NetBSD: wcscmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $ */ /*- @@ -34,7 +34,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: wcscmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $"; +static char *rcsid = "$OpenBSD: wcscmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -51,5 +51,5 @@ wcscmp(const wchar_t *s1, const wchar_t *s2) if (*s1++ == 0) return (0); /* XXX assumes wchar_t = int */ - return (*(const __nbrune_t *)s1 - *(const __nbrune_t *)--s2); + return (*(const rune_t *)s1 - *(const rune_t *)--s2); } diff --git a/src/lib/libc/string/wcsncmp.c b/src/lib/libc/string/wcsncmp.c index aaa96b97a6..30d37f6657 100644 --- a/src/lib/libc/string/wcsncmp.c +++ b/src/lib/libc/string/wcsncmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wcsncmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $ */ +/* $OpenBSD: wcsncmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $ */ /* $NetBSD: wcsncmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $ */ /* @@ -31,7 +31,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: wcsncmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $"; +static char *rcsid = "$OpenBSD: wcsncmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -46,8 +46,8 @@ wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n) do { if (*s1 != *s2++) { /* XXX assumes wchar_t = int */ - return (*(const __nbrune_t *)s1 - - *(const __nbrune_t *)--s2); + return (*(const rune_t *)s1 - + *(const rune_t *)--s2); } if (*s1++ == 0) break; diff --git a/src/lib/libc/string/wmemcmp.c b/src/lib/libc/string/wmemcmp.c index fc021c11d1..e35c6207ff 100644 --- a/src/lib/libc/string/wmemcmp.c +++ b/src/lib/libc/string/wmemcmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wmemcmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $ */ +/* $OpenBSD: wmemcmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $ */ /* $NetBSD: wmemcmp.c,v 1.3 2003/04/06 18:33:23 tshiozak Exp $ */ /*- @@ -30,7 +30,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: wmemcmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $"; +static char *rcsid = "$OpenBSD: wmemcmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -44,8 +44,8 @@ wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n) for (i = 0; i < n; i++) { if (*s1 != *s2) { /* wchar might be unsigned */ - return *(const __nbrune_t *)s1 > - *(const __nbrune_t *)s2 ? 1 : -1; + return *(const rune_t *)s1 > + *(const rune_t *)s2 ? 1 : -1; } s1++; s2++; -- cgit v1.2.3-55-g6feb