summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-04-30 05:49:22 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-04-30 05:49:22 +0000
commitfd1e6c7f3c25d831d0731a4c23eed63ae62fa97f (patch)
treef972eb945a59203495c000b908de7605084b0553
parentc3a1d09768d20495f75e59ddfb146a050c2b99f1 (diff)
make ctype macros on char 0x82 and such work
-rw-r--r--include/ctype.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/include/ctype.h b/include/ctype.h
index 8162bb7f537..942bfc8660a 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctype.h,v 1.2 1997/09/21 10:45:28 niklas Exp $ */
+/* $OpenBSD: ctype.h,v 1.3 1998/04/30 05:49:21 deraadt Exp $ */
/* $NetBSD: ctype.h,v 1.14 1994/10/26 00:55:47 cgd Exp $ */
/*
@@ -82,25 +82,25 @@ extern int _toupper __P ((int));
#endif
__END_DECLS
-#define isdigit(c) ((_ctype_ + 1)[c] & _N)
-#define islower(c) ((_ctype_ + 1)[c] & _L)
-#define isspace(c) ((_ctype_ + 1)[c] & _S)
-#define ispunct(c) ((_ctype_ + 1)[c] & _P)
-#define isupper(c) ((_ctype_ + 1)[c] & _U)
-#define isalpha(c) ((_ctype_ + 1)[c] & (_U|_L))
-#define isxdigit(c) ((_ctype_ + 1)[c] & (_N|_X))
-#define isalnum(c) ((_ctype_ + 1)[c] & (_U|_L|_N))
-#define isprint(c) ((_ctype_ + 1)[c] & (_P|_U|_L|_N|_B))
-#define isgraph(c) ((_ctype_ + 1)[c] & (_P|_U|_L|_N))
-#define iscntrl(c) ((_ctype_ + 1)[c] & _C)
-#define tolower(c) ((_tolower_tab_ + 1)[c])
-#define toupper(c) ((_toupper_tab_ + 1)[c])
+#define isdigit(c) ((_ctype_ + 1)[(unsigned char)(c)] & _N)
+#define islower(c) ((_ctype_ + 1)[(unsigned char)(c)] & _L)
+#define isspace(c) ((_ctype_ + 1)[(unsigned char)(c)] & _S)
+#define ispunct(c) ((_ctype_ + 1)[(unsigned char)(c)] & _P)
+#define isupper(c) ((_ctype_ + 1)[(unsigned char)(c)] & _U)
+#define isalpha(c) ((_ctype_ + 1)[(unsigned char)(c)] & (_U|_L))
+#define isxdigit(c) ((_ctype_ + 1)[(unsigned char)(c)] & (_N|_X))
+#define isalnum(c) ((_ctype_ + 1)[(unsigned char)(c)] & (_U|_L|_N))
+#define isprint(c) ((_ctype_ + 1)[(unsigned char)(c)] & (_P|_U|_L|_N|_B))
+#define isgraph(c) ((_ctype_ + 1)[(unsigned char)(c)] & (_P|_U|_L|_N))
+#define iscntrl(c) ((_ctype_ + 1)[(unsigned char)(c)] & _C)
+#define tolower(c) ((_tolower_tab_ + 1)[(unsigned char)(c)])
+#define toupper(c) ((_toupper_tab_ + 1)[(unsigned char)(c)])
#if !defined(_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
#if notyet
-#define isblank(c) ((_ctype_ + 1)[c] & _B)
+#define isblank(c) ((_ctype_ + 1)[(unsigned char)(c)] & _B)
#endif
-#define isascii(c) ((unsigned)(c) <= 0177)
+#define isascii(c) ((unsigned char)(c) <= 0177)
#define toascii(c) ((c) & 0177)
#define _tolower(c) ((c) - 'A' + 'a')
#define _toupper(c) ((c) - 'a' + 'A')