summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-09-21 13:22:20 +0000
committerJim Meyering <jim@meyering.net>1997-09-21 13:22:20 +0000
commit89d48552da3ba7ab2160b06989d0866724638579 (patch)
treee00d7f0d8c14fe357da83240a2e4c3570863fb71
parent29becc72aca2fc197affdc10b1aaab0e3abad1c2 (diff)
downloadcoreutils-89d48552da3ba7ab2160b06989d0866724638579.tar.xz
(IN_CTYPE_DOMAIN): Define.
(ISSPACE): Guard with IN_CTYPE_DOMAIN. (ISDIGIT): Guard with IN_CTYPE_DOMAIN. (TOUPPER): Guard with IN_CTYPE_DOMAIN. From Bruno Haible.
-rw-r--r--lib/strtol.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/strtol.c b/lib/strtol.c
index 0d3ec1bab..6d5f4ac4d 100644
--- a/lib/strtol.c
+++ b/lib/strtol.c
@@ -129,12 +129,17 @@ extern int errno;
# define ISALPHA(Ch) iswalpha (Ch)
# define TOUPPER(Ch) towupper (Ch)
#else
+# if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
+# define IN_CTYPE_DOMAIN(c) 1
+# else
+# define IN_CTYPE_DOMAIN(c) isascii(c)
+# endif
# define L_(Ch) Ch
# define UCHAR_TYPE unsigned char
# define STRING_TYPE char
-# define ISSPACE(Ch) isspace (Ch)
-# define ISALPHA(Ch) isalpha (Ch)
-# define TOUPPER(Ch) toupper (Ch)
+# define ISSPACE(Ch) (IN_CTYPE_DOMAIN (Ch) && isspace (Ch))
+# define ISALPHA(Ch) (IN_CTYPE_DOMAIN (Ch) && isalpha (Ch))
+# define TOUPPER(Ch) (IN_CTYPE_DOMAIN (Ch) ? toupper (Ch) : (Ch))
#endif
#ifdef __STDC__