thousands[cnt] != '\0'; })
cnt < thousands_len; })
INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)     const STRING_TYPE *nptr;     STRING_TYPE **endptr;     int base;     int group;     LOCALE_PARAM_DECL{  int negative;  register unsigned LONG int cutoff;  register unsigned int cutlim;  register unsigned LONG int i;  register const STRING_TYPE *s;  register UCHAR_TYPE c;  const STRING_TYPE *save, *end;  int overflow;#ifndef USE_WIDE_CHAR  int cnt;#endif#ifdef USE_NUMBER_GROUPING# ifdef USE_IN_EXTENDED_LOCALE_MODEL  struct locale_data *current = loc->__locales[LC_NUMERIC];# endif  /* The thousands character of the current locale.  */# ifdef USE_WIDE_CHAR  wchar_t thousands = L'\0';# else  const char *thousands = NULL;# endif  /* The numeric grouping specification of the current locale,     in the format described in <locale.h>.  */  const char *grouping;  if (group)    {      grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);      if (*grouping <= 0 || *grouping == CHAR_MAX)	grouping = NULL;      else	{	  /* Figure out the thousands separator character.  */# ifdef USE_WIDE_CHAR#  ifdef _LIBC	  thousands = _NL_CURRENT_WORD (LC_NUMERIC,					_NL_NUMERIC_THOUSANDS_SEP_WC);#  endif	  if (thousands == L'\0')	    grouping = NULL;# else#  ifdef _LIBC	  thousands = _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);#  endif	  if (*thousands == '\0')	    {	      thousands = NULL;	      grouping = NULL;	    }# endif	}    }  else    grouping = NULL;#endif  if (base < 0 || base == 1 || base > 36)    {      __set_errno (EINVAL);      return 0;    }  save = s = nptr;  /* Skip white space.  */  while (ISSPACE (*s))    ++s;  if (*s == L_('\0'))    goto noconv;  /* Check for a sign.  */  if (*s == L_('-'))    {      negative = 1;      ++s;    }  else if (*s == L_('+'))    {      negative = 0;      ++s;    }  else    negative = 0;  /* Recognize number prefix and if BASE is zero, figure it out ourselves.  */  if (*s == L_('0'))    {      if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X'))	{	  s += 2;	  base = 16;	}      else if (base == 0)	base = 8;    }  else if (base == 0)    base = 10;  /* Save the pointer so we can check later if anything happened.  */  save = s;#ifdef USE_NUMBER_GROUPING  if (group)    {      /* Find the end of the digit string and check its grouping.  */      end = s;      if (# ifdef USE_WIDE_CHAR	  *s != thousands# else	  ({ for (cnt = 0; thousands[cnt] != '\0'; ++cnt)	       if (thousands[cnt] != end[cnt])		 break;	     thousands[cnt] != '\0'; })# endif	  )	{	  for (c = *end; c != L_('\0'); c = *++end)	    if (((wchar_t) c < L_('0') || (wchar_t) c > L_('9'))# ifdef USE_WIDE_CHAR		&& c != thousands# else		&& ({ for (cnt = 0; thousands[cnt] != '\0'; ++cnt)		      if (thousands[cnt] != end[cnt])			break;		      thousands[cnt] != '\0'; })# endif		&& (!ISALPHA (c)		    || (int) (TOUPPER (c) - L_('A') + 10) >= base))	      break;	  end = correctly_grouped_prefix (s, end, thousands, grouping);	}    }  else#endif    end = NULL;  cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base;  cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base;  overflow = 0;  i = 0;  c = *s;  if (sizeof (long int) != sizeof (LONG int))    {      unsigned long int j = 0;      unsigned long int jmax = ULONG_MAX / base;      for (;c != L_('\0'); c = *++s)	{	  if (s == end)	    break;	  if (c >= L_('0') && c <= L_('9'))	    c -= L_('0');	  else if (ISALPHA (c))	    c = TOUPPER (c) - L_('A') + 10;	  else	    break;	  if ((int) c >= base)	    break;	  /* Note that we never can have an overflow.  */	  else if (j >= jmax)	    {	      /* We have an overflow.  Now use the long representation.  */	      i = (unsigned LONG int) j;	      goto use_long;	    }	  else	    j = j * (unsigned long int) base + c;	}      i = (unsigned LONG int) j;    }  else    for (;c != L_('\0'); c = *++s)      {	if (s == end)	  break;	if (c >= L_('0') && c <= L_('9'))	  c -= L_('0');	else if (ISALPHA (c))	  c = TOUPPER (c) - L_('A') + 10;	else	  break;	if ((int) c >= base)	  break;	/* Check for overflow.  */	if (i > cutoff || (i == cutoff && c > cutlim))	  overflow = 1;	else	  {	  use_long:	    i *= (unsigned LONG int) base;	    i += c;	  }      }  /* Check if anything actually happened.  */  if (s == save)    goto noconv;  /* Store in ENDPTR the address of one character     past the last character we converted.  */  if (endptr != NULL)    *endptr = (STRING_TYPE *) s;#if !UNSIGNED  /* Check for a value that is within the range of     `unsigned LONG int', but outside the range of `LONG int'.  */  if (overflow == 0      && i > (negative	      ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1	      : (unsigned LONG int) STRTOL_LONG_MAX))    overflow = 1;#endif  if (overflow)    {      __set_errno (ERANGE);#if UNSIGNED      return STRTOL_ULONG_MAX;#else      return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX;#endif    }  /* Return the result of the appropriate sign.  */  return negative ? -i : i;noconv:  /* We must handle a special case here: the base is 0 or 16 and the     first two characters are '0' and 'x', but the rest are no     hexadecimal digits.  This is no error case.  We return 0 and     ENDPTR points to the `x`.  */  if (endptr != NULL)    {      if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')	  && save[-2] == L_('0'))	*endptr = (STRING_TYPE *) &save[-1];      else	/*  There was no number to convert.  */	*endptr = (STRING_TYPE *) nptr;    }  return 0L;}