summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-12-29 03:02:36 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-12-29 03:02:36 +0000
commitc9a988de4e75ded9aabfa6aae935a77db1b4ea5c (patch)
treeeb97b400293f1b3e18b26497cb806139d1400c34
parent8c9e7ccf1f94a52fae91d554d87684d5ff7ef312 (diff)
Don't define EOF In ctype.h, some 3rd party code checks whether or
not EOF is defined to determine if stdio.h has been included. Instead, use __EOF which should be OK wrt namespace safety.
-rw-r--r--include/ctype.h28
-rw-r--r--include/stdio.h8
2 files changed, 21 insertions, 15 deletions
diff --git a/include/ctype.h b/include/ctype.h
index d8caec1c604..3fd79836c37 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctype.h,v 1.10 2002/12/15 13:53:39 millert Exp $ */
+/* $OpenBSD: ctype.h,v 1.11 2002/12/29 03:02:35 millert Exp $ */
/* $NetBSD: ctype.h,v 1.14 1994/10/26 00:55:47 cgd Exp $ */
/*
@@ -54,7 +54,9 @@
#define _X 0x40
#define _B 0x80
-#define EOF (-1)
+#ifndef __EOF
+#define __EOF (-1) /* must match stdio.h */
+#endif
extern const char *_ctype_;
extern const short *_tolower_tab_;
@@ -89,57 +91,57 @@ __END_DECLS
static __inline int isalnum(int c)
{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & (_U|_L|_N)));
+ return (c == __EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & (_U|_L|_N)));
}
static __inline int isalpha(int c)
{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & (_U|_L)));
+ return (c == __EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & (_U|_L)));
}
static __inline int iscntrl(int c)
{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & _C));
+ return (c == __EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & _C));
}
static __inline int isdigit(int c)
{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & _N));
+ return (c == __EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & _N));
}
static __inline int isgraph(int c)
{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & (_P|_U|_L|_N)));
+ return (c == __EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & (_P|_U|_L|_N)));
}
static __inline int islower(int c)
{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & _L));
+ return (c == __EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & _L));
}
static __inline int isprint(int c)
{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & (_P|_U|_L|_N|_B)));
+ return (c == __EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & (_P|_U|_L|_N|_B)));
}
static __inline int ispunct(int c)
{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & _P));
+ return (c == __EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & _P));
}
static __inline int isspace(int c)
{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & _S));
+ return (c == __EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & _S));
}
static __inline int isupper(int c)
{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & _U));
+ return (c == __EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & _U));
}
static __inline int isxdigit(int c)
{
- return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & (_N|_X)));
+ return (c == __EOF ? 0 : ((_ctype_ + 1)[(unsigned char)(c & 0xff)] & (_N|_X)));
}
static __inline int tolower(int c)
diff --git a/include/stdio.h b/include/stdio.h
index d2a62bc6242..0c134846b6e 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stdio.h,v 1.23 2002/10/25 21:55:28 millert Exp $ */
+/* $OpenBSD: stdio.h,v 1.24 2002/12/29 03:02:34 millert Exp $ */
/* $NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $ */
/*-
@@ -175,7 +175,11 @@ __END_DECLS
#define _IONBF 2 /* setvbuf should set unbuffered */
#define BUFSIZ 1024 /* size of buffer used by setbuf */
-#define EOF (-1)
+
+#ifndef __EOF
+#define __EOF (-1)
+#endif
+#define EOF __EOF
/*
* FOPEN_MAX is a minimum maximum, and should be the number of descriptors