Line 33... |
Line 33... |
case, e.g. ISALPHA not isalpha. */
|
case, e.g. ISALPHA not isalpha. */
|
|
|
#ifndef SAFE_CTYPE_H
|
#ifndef SAFE_CTYPE_H
|
#define SAFE_CTYPE_H
|
#define SAFE_CTYPE_H
|
|
|
#ifdef isalpha
|
|
#error "safe-ctype.h and ctype.h may not be used simultaneously"
|
|
#endif
|
|
|
|
/* Determine host character set. */
|
/* Determine host character set. */
|
#define HOST_CHARSET_UNKNOWN 0
|
#define HOST_CHARSET_UNKNOWN 0
|
#define HOST_CHARSET_ASCII 1
|
#define HOST_CHARSET_ASCII 1
|
#define HOST_CHARSET_EBCDIC 2
|
#define HOST_CHARSET_EBCDIC 2
|
|
|
Line 114... |
Line 110... |
extern const unsigned char _sch_toupper[256];
|
extern const unsigned char _sch_toupper[256];
|
extern const unsigned char _sch_tolower[256];
|
extern const unsigned char _sch_tolower[256];
|
#define TOUPPER(c) _sch_toupper[(c) & 0xff]
|
#define TOUPPER(c) _sch_toupper[(c) & 0xff]
|
#define TOLOWER(c) _sch_tolower[(c) & 0xff]
|
#define TOLOWER(c) _sch_tolower[(c) & 0xff]
|
|
|
|
/* Prevent the users of safe-ctype.h from accidently using the routines
|
|
from ctype.h. Initially, the approach was to produce an error when
|
|
detecting that ctype.h has been included. But this was causing
|
|
trouble as ctype.h might get indirectly included as a result of
|
|
including another system header (for instance gnulib's stdint.h).
|
|
So we include ctype.h here and then immediately redefine its macros. */
|
|
|
|
#include <ctype.h>
|
|
#undef isalpha
|
|
#define isalpha(c) do_not_use_isalpha_with_safe_ctype
|
|
#undef isalnum
|
|
#define isalnum(c) do_not_use_isalnum_with_safe_ctype
|
|
#undef iscntrl
|
|
#define iscntrl(c) do_not_use_iscntrl_with_safe_ctype
|
|
#undef isdigit
|
|
#define isdigit(c) do_not_use_isdigit_with_safe_ctype
|
|
#undef isgraph
|
|
#define isgraph(c) do_not_use_isgraph_with_safe_ctype
|
|
#undef islower
|
|
#define islower(c) do_not_use_islower_with_safe_ctype
|
|
#undef isprint
|
|
#define isprint(c) do_not_use_isprint_with_safe_ctype
|
|
#undef ispunct
|
|
#define ispunct(c) do_not_use_ispunct_with_safe_ctype
|
|
#undef isspace
|
|
#define isspace(c) do_not_use_isspace_with_safe_ctype
|
|
#undef isupper
|
|
#define isupper(c) do_not_use_isupper_with_safe_ctype
|
|
#undef isxdigit
|
|
#define isxdigit(c) do_not_use_isxdigit_with_safe_ctype
|
|
#undef toupper
|
|
#define toupper(c) do_not_use_toupper_with_safe_ctype
|
|
#undef tolower
|
|
#define tolower(c) do_not_use_tolower_with_safe_ctype
|
|
|
#endif /* SAFE_CTYPE_H */
|
#endif /* SAFE_CTYPE_H */
|
|
|
No newline at end of file
|
No newline at end of file
|