From cca19fe7264e46e7cdd694359b93d7816d7978ce Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 23 Oct 1997 01:29:44 +0000 Subject: Add (unsigned char) cast to all ctype macros --- contrib/awk/awk.h | 28 ++++++++++++++-------------- contrib/awk/dfa.c | 46 +++++++++++++++++++++++----------------------- 2 files changed, 37 insertions(+), 37 deletions(-) (limited to 'contrib/awk') diff --git a/contrib/awk/awk.h b/contrib/awk/awk.h index 3ab2015..b87a645 100644 --- a/contrib/awk/awk.h +++ b/contrib/awk/awk.h @@ -65,30 +65,30 @@ extern int errno; #if defined(STDC_HEADERS) || (!defined(isascii) && !defined(HAVE_ISASCII)) #define ISASCII(c) 1 #else -#define ISASCII(c) isascii(c) +#define ISASCII(c) isascii((unsigned char)c) #endif #ifdef isblank -#define ISBLANK(c) (ISASCII(c) && isblank(c)) +#define ISBLANK(c) (ISASCII(c) && isblank((unsigned char)c)) #else #define ISBLANK(c) ((c) == ' ' || (c) == '\t') #endif #ifdef isgraph -#define ISGRAPH(c) (ISASCII(c) && isgraph(c)) +#define ISGRAPH(c) (ISASCII(c) && isgraph((unsigned char)c)) #else -#define ISGRAPH(c) (ISASCII(c) && isprint(c) && !isspace(c)) +#define ISGRAPH(c) (ISASCII(c) && isprint((unsigned char)c) && !isspace((unsigned char)c)) #endif -#define ISPRINT(c) (ISASCII (c) && isprint (c)) -#define ISDIGIT(c) (ISASCII (c) && isdigit (c)) -#define ISALNUM(c) (ISASCII (c) && isalnum (c)) -#define ISALPHA(c) (ISASCII (c) && isalpha (c)) -#define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) -#define ISLOWER(c) (ISASCII (c) && islower (c)) -#define ISPUNCT(c) (ISASCII (c) && ispunct (c)) -#define ISSPACE(c) (ISASCII (c) && isspace (c)) -#define ISUPPER(c) (ISASCII (c) && isupper (c)) -#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) +#define ISPRINT(c) (ISASCII (c) && isprint ((unsigned char)c)) +#define ISDIGIT(c) (ISASCII (c) && isdigit ((unsigned char)c)) +#define ISALNUM(c) (ISASCII (c) && isalnum ((unsigned char)c)) +#define ISALPHA(c) (ISASCII (c) && isalpha ((unsigned char)c)) +#define ISCNTRL(c) (ISASCII (c) && iscntrl ((unsigned char)c)) +#define ISLOWER(c) (ISASCII (c) && islower ((unsigned char)c)) +#define ISPUNCT(c) (ISASCII (c) && ispunct ((unsigned char)c)) +#define ISSPACE(c) (ISASCII (c) && isspace ((unsigned char)c)) +#define ISUPPER(c) (ISASCII (c) && isupper ((unsigned char)c)) +#define ISXDIGIT(c) (ISASCII (c) && isxdigit ((unsigned char)c)) #ifdef __STDC__ diff --git a/contrib/awk/dfa.c b/contrib/awk/dfa.c index c806bea..88e8e3e 100644 --- a/contrib/awk/dfa.c +++ b/contrib/awk/dfa.c @@ -48,33 +48,33 @@ extern void free(); #endif /* DEBUG */ #ifndef isgraph -#define isgraph(C) (isprint(C) && !isspace(C)) +#define isgraph(C) (isprint((unsigned char)C) && !isspace((unsigned char)C)) #endif #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) -#define ISALPHA(C) isalpha(C) -#define ISUPPER(C) isupper(C) -#define ISLOWER(C) islower(C) -#define ISDIGIT(C) isdigit(C) -#define ISXDIGIT(C) isxdigit(C) -#define ISSPACE(C) isspace(C) -#define ISPUNCT(C) ispunct(C) -#define ISALNUM(C) isalnum(C) -#define ISPRINT(C) isprint(C) -#define ISGRAPH(C) isgraph(C) -#define ISCNTRL(C) iscntrl(C) +#define ISALPHA(C) isalpha((unsigned char)C) +#define ISUPPER(C) isupper((unsigned char)C) +#define ISLOWER(C) islower((unsigned char)C) +#define ISDIGIT(C) isdigit((unsigned char)C) +#define ISXDIGIT(C) isxdigit((unsigned char)C) +#define ISSPACE(C) isspace((unsigned char)C) +#define ISPUNCT(C) ispunct((unsigned char)C) +#define ISALNUM(C) isalnum((unsigned char)C) +#define ISPRINT(C) isprint((unsigned char)C) +#define ISGRAPH(C) isgraph((unsigned char)C) +#define ISCNTRL(C) iscntrl((unsigned char)C) #else -#define ISALPHA(C) (isascii(C) && isalpha(C)) -#define ISUPPER(C) (isascii(C) && isupper(C)) -#define ISLOWER(C) (isascii(C) && islower(C)) -#define ISDIGIT(C) (isascii(C) && isdigit(C)) -#define ISXDIGIT(C) (isascii(C) && isxdigit(C)) -#define ISSPACE(C) (isascii(C) && isspace(C)) -#define ISPUNCT(C) (isascii(C) && ispunct(C)) -#define ISALNUM(C) (isascii(C) && isalnum(C)) -#define ISPRINT(C) (isascii(C) && isprint(C)) -#define ISGRAPH(C) (isascii(C) && isgraph(C)) -#define ISCNTRL(C) (isascii(C) && iscntrl(C)) +#define ISALPHA(C) (isascii((unsigned char)C) && isalpha(C)) +#define ISUPPER(C) (isascii((unsigned char)C) && isupper(C)) +#define ISLOWER(C) (isascii((unsigned char)C) && islower(C)) +#define ISDIGIT(C) (isascii((unsigned char)C) && isdigit(C)) +#define ISXDIGIT(C) (isascii((unsigned char)C) && isxdigit(C)) +#define ISSPACE(C) (isascii((unsigned char)C) && isspace(C)) +#define ISPUNCT(C) (isascii((unsigned char)C) && ispunct(C)) +#define ISALNUM(C) (isascii((unsigned char)C) && isalnum(C)) +#define ISPRINT(C) (isascii((unsigned char)C) && isprint(C)) +#define ISGRAPH(C) (isascii((unsigned char)C) && isgraph(C)) +#define ISCNTRL(C) (isascii((unsigned char)C) && iscntrl(C)) #endif #ifndef __FreeBSD__ -- cgit v1.1