diff --git a/basicdefs.h b/basicdefs.h index 2d864a6..7865505 100644 --- a/basicdefs.h +++ b/basicdefs.h @@ -67,7 +67,6 @@ #undef ISPRINT #define ISPRINT(c) (ISASCII (c) && isprint (c)) -#define ISDIGIT(c) (ISASCII (c) && isdigit ((unsigned char) (c))) #define ISALNUM(c) (ISASCII (c) && isalnum (c)) #define ISALPHA(c) (ISASCII (c) && isalpha (c)) #define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) diff --git a/bootstrap.conf b/bootstrap.conf index e562cfc..40b0879 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -25,6 +25,7 @@ acl binary-io bool btowc +c-ctype dfa eloop-threshold extensions diff --git a/lib/.gitignore b/lib/.gitignore index 8bd1cd8..bfb9973 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -18,6 +18,8 @@ /btoc32.c /btowc.c /c++defs.h +/c-ctype.c +/c-ctype.h /c32_apply_type_test.c /c32_get_type_test.c /c32is-impl.h diff --git a/sed/compile.c b/sed/compile.c index fcd315b..891f4fc 100644 --- a/sed/compile.c +++ b/sed/compile.c @@ -25,6 +25,7 @@ #include #include #include +#include "c-ctype.h" #include "read-file.h" #include "progname.h" #include "xalloc.h" @@ -200,7 +201,7 @@ in_integer (int ch) { intmax_t num = 0; - while (ISDIGIT (ch)) + while (c_isdigit (ch)) { if (ckd_mul (&num, num, 10) || ckd_add (&num, num, ch - '0')) num = INTMAX_MAX; @@ -472,7 +473,7 @@ match_slash (int slash, bool regex, bool s_command) = ((extended_regexp_flags & REG_EXTENDED) ? ".[\\()*+?{}|^$" : ".[\\*^$)({}"); if (s_command && posixicity != POSIXLY_EXTENDED && ch != '&' - && ch != '\\' && !ISDIGIT (ch) && ch != '\n' && ch != slash + && ch != '\\' && !c_isdigit (ch) && ch != '\n' && ch != slash && !strchr (special_chars, ch)) fprintf (stderr, _("%s: warning: using \"\\%c\" in the 's' " "command is not portable\n"), @@ -682,7 +683,7 @@ setup_replacement (struct subst *sub, const char *text, idx_t length) if (p == text_end) ++tail->prefix_length; - else if (posixicity == POSIXLY_BASIC && !ISDIGIT (*p)) + else if (posixicity == POSIXLY_BASIC && !c_isdigit (*p)) { p[-1] = *p; ++tail->prefix_length; @@ -848,7 +849,7 @@ compile_address (struct addr *addr, int ch) } } } - else if (ISDIGIT (ch)) + else if (c_isdigit (ch)) { addr->addr_number = in_integer (ch); addr->addr_type = ADDR_IS_NUM; @@ -1077,7 +1078,7 @@ compile_program (struct vector *vector) case 'l': ch = in_nonblank (); - if (ISDIGIT (ch) && posixicity != POSIXLY_BASIC) + if (c_isdigit (ch) && posixicity != POSIXLY_BASIC) { cur_cmd->x.int_arg = in_integer (ch); }