diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2005-08-08 05:53:02 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2005-08-08 05:53:02 +0000 |
commit | b83058fd179b6de492fa3ed6292d2821ca253806 (patch) | |
tree | 2baae503ebb022ad1d8ff55383cedcf18b319815 /lib/libc/gen | |
parent | 9912e93b5b9dbc80863c5b26ff459f0587f40cbe (diff) |
activate LC_CTYPE for 8 bits locale.
Make sure tolower/toupper use the whole 8 bits.
okay deraadt@
thanks to everyone who tested
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/ctype_.c | 14 | ||||
-rw-r--r-- | lib/libc/gen/tolower_.c | 7 | ||||
-rw-r--r-- | lib/libc/gen/toupper_.c | 6 |
3 files changed, 12 insertions, 15 deletions
diff --git a/lib/libc/gen/ctype_.c b/lib/libc/gen/ctype_.c index 269725af513..7f7c0adb3c8 100644 --- a/lib/libc/gen/ctype_.c +++ b/lib/libc/gen/ctype_.c @@ -33,12 +33,13 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: ctype_.c,v 1.7 2005/07/13 19:15:07 otto Exp $"; +static char rcsid[] = "$OpenBSD: ctype_.c,v 1.8 2005/08/08 05:53:00 espie Exp $"; #endif /* LIBC_SCCS and not lint */ #include <ctype.h> +#include "ctype_private.h" -const char _C_ctype_[1 + 256] = { +const char _C_ctype_[1 + CTYPE_NUM_CHARS] = { 0, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C, @@ -55,13 +56,7 @@ const char _C_ctype_[1 + 256] = { _P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, _L, -/* - * define USE7BIT to force 7-bit ANSI behavior, otherwise the routine - * will determine printability based on the IS0 8859 8-bit standard - */ -#ifdef USE7BIT - _L, _L, _L, _P, _P, _P, _P, _C -#else +/* determine printability based on the IS0 8859 8-bit standard */ _L, _L, _L, _P, _P, _P, _P, _C, _C, _C, _C, _C, _C, _C, _C, _C, /* 80 */ @@ -80,7 +75,6 @@ const char _C_ctype_[1 + 256] = { _P, _P, _P, _P, _P, _P, _P, _P, /* E8 */ _P, _P, _P, _P, _P, _P, _P, _P, /* F0 */ _P, _P, _P, _P, _P, _P, _P, _P /* F8 */ -#endif /*USE7BIT*/ }; const char *_ctype_ = _C_ctype_; diff --git a/lib/libc/gen/tolower_.c b/lib/libc/gen/tolower_.c index 160c4be3c0c..cd98f88af73 100644 --- a/lib/libc/gen/tolower_.c +++ b/lib/libc/gen/tolower_.c @@ -4,14 +4,15 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: tolower_.c,v 1.7 2004/05/18 02:05:52 jfb Exp $"; +static char rcsid[] = "$OpenBSD: tolower_.c,v 1.8 2005/08/08 05:53:00 espie Exp $"; #endif /* LIBC_SCCS and not lint */ #define _ANSI_LIBRARY #include <ctype.h> #include <stdio.h> +#include "ctype_private.h" -const short _C_tolower_[1 + 256] = { +const short _C_tolower_[1 + CTYPE_NUM_CHARS] = { EOF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, @@ -53,7 +54,7 @@ const short *_tolower_tab_ = _C_tolower_; int tolower(int c) { - if ((unsigned int)c > 0177) + if ((unsigned int)c > 255) return(c); return((_tolower_tab_ + 1)[c]); } diff --git a/lib/libc/gen/toupper_.c b/lib/libc/gen/toupper_.c index 65b6cfab977..fdb87bc3a29 100644 --- a/lib/libc/gen/toupper_.c +++ b/lib/libc/gen/toupper_.c @@ -4,13 +4,15 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: toupper_.c,v 1.7 2004/05/18 02:05:52 jfb Exp $"; +static char rcsid[] = "$OpenBSD: toupper_.c,v 1.8 2005/08/08 05:53:00 espie Exp $"; #endif /* LIBC_SCCS and not lint */ #define _ANSI_LIBRARY #include <ctype.h> #include <stdio.h> +#include "ctype_private.h" + const short _C_toupper_[1 + 256] = { EOF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, @@ -53,7 +55,7 @@ const short *_toupper_tab_ = _C_toupper_; int toupper(int c) { - if ((unsigned int)c > 0177) + if ((unsigned int)c > 255) return(c); return((_toupper_tab_ + 1)[c]); } |