summary refs log tree commit diff
path: root/stdlib/strtol.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/strtol.c')
-rw-r--r--stdlib/strtol.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/stdlib/strtol.c b/stdlib/strtol.c
index 97ad23453b..19e4a52880 100644
--- a/stdlib/strtol.c
+++ b/stdlib/strtol.c
@@ -184,6 +184,11 @@ extern int errno;
 #  define TOUPPER(Ch) towupper (Ch)
 # endif
 # 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
@@ -192,9 +197,9 @@ extern int errno;
 #  define ISALPHA(Ch) __isalpha_l ((Ch), loc)
 #  define TOUPPER(Ch) __toupper_l ((Ch), loc)
 # else
-#  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
 #endif