diff options
author | ache <ache@FreeBSD.org> | 1995-01-11 04:56:51 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-01-11 04:56:51 +0000 |
commit | f15a1abdd698097203581d1d7a8bec269bff4870 (patch) | |
tree | 8ce287a4a9a13dc60488216e5bfc5066aa48662a | |
parent | b8bae0240dc8aa32af7aff5628cbb7ea4491fd02 (diff) | |
download | FreeBSD-src-f15a1abdd698097203581d1d7a8bec269bff4870.zip FreeBSD-src-f15a1abdd698097203581d1d7a8bec269bff4870.tar.gz |
Changes for 8-bit ctype
-rw-r--r-- | gnu/lib/libregex/regex.c | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/gnu/lib/libregex/regex.c b/gnu/lib/libregex/regex.c index 8169880..e18f914 100644 --- a/gnu/lib/libregex/regex.c +++ b/gnu/lib/libregex/regex.c @@ -79,6 +79,9 @@ char *realloc (); #define Sword 1 #endif +/* isalpha etc. are used for the character classes. */ +#include <ctype.h> + #ifdef SYNTAX_TABLE extern char *re_syntax_table; @@ -101,14 +104,9 @@ init_syntax_once () bzero (re_syntax_table, sizeof re_syntax_table); - for (c = 'a'; c <= 'z'; c++) - re_syntax_table[c] = Sword; - - for (c = 'A'; c <= 'Z'; c++) - re_syntax_table[c] = Sword; - - for (c = '0'; c <= '9'; c++) - re_syntax_table[c] = Sword; + for (c = 0; c < CHAR_SET_SIZE; c++) + if (isalnum(c)) + re_syntax_table[c] = Sword; re_syntax_table['_'] = Sword; @@ -124,34 +122,27 @@ init_syntax_once () /* Get the interface, including the syntax bits. */ #include "regex.h" -/* isalpha etc. are used for the character classes. */ -#include <ctype.h> - -#ifndef isascii -#define isascii(c) 1 -#endif - #ifdef isblank -#define ISBLANK(c) (isascii (c) && isblank (c)) +#define ISBLANK(c) isblank (c) #else #define ISBLANK(c) ((c) == ' ' || (c) == '\t') #endif #ifdef isgraph -#define ISGRAPH(c) (isascii (c) && isgraph (c)) +#define ISGRAPH(c) isgraph (c) #else -#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c)) +#define ISGRAPH(c) (isprint (c) && !isspace (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) isprint (c) +#define ISDIGIT(c) isdigit (c) +#define ISALNUM(c) isalnum (c) +#define ISALPHA(c) isalpha (c) +#define ISCNTRL(c) iscntrl (c) +#define ISLOWER(c) islower (c) +#define ISPUNCT(c) ispunct (c) +#define ISSPACE(c) isspace (c) +#define ISUPPER(c) isupper (c) +#define ISXDIGIT(c) isxdigit (c) #ifndef NULL #define NULL 0 |