# include <config.h>
#endif
+/* Some pre-ANSI implementations (e.g. SunOS 4)
+ need stderr defined if assertion checking is enabled. */
#include <stdio.h>
#if STDC_HEADERS
# endif
#endif
-/* Some pre-ANSI implementations (e.g. SunOS 4)
- need stderr defined if assertion checking is enabled. */
-#ifndef NDEBUG
-# include <stdio.h>
-#endif
-
#include <assert.h>
#include <errno.h>
# define LONG_MAX TYPE_MAXIMUM (long int)
#endif
+#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
+# define IN_CTYPE_DOMAIN(c) 1
+#else
+# define IN_CTYPE_DOMAIN(c) isascii(c)
+#endif
+
+#ifdef isblank
+# define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (c))
+#else
+# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
+#endif
+
#include "xstrtol.h"
__unsigned long int __strtol ();
p = (ptr ? ptr : &t_ptr);
+#if STRING_TO_UNSIGNED
+ {
+ const char *q = s;
+ while (ISBLANK (*q))
+ {
+ ++q;
+ }
+ if (*q == '-')
+ return LONGINT_INVALID;
+ }
+#endif
+
errno = 0;
tmp = __strtol (s, p, strtol_base);
if (errno != 0)