-/*------------------------------------------------------------------------.
-| Check if STRING0 is the decimal representation of number, and store its |
-| value. If not a decimal number, return 0. |
-`------------------------------------------------------------------------*/
-
-static int
-check_decimal (const char *string0, uintmax_t *result)
-{
- const char *string = string0;
- uintmax_t value = 0;
-
- do
- switch (*string)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- {
- uintmax_t v10 = value * 10;
- uintmax_t v10d = v10 + (*string - '0');
- if (v10 / 10 != value || v10d < v10)
- return 0;
- value = v10d;
- }
- break;
-
- default:
- return 0;
- }
- while (*++string);
-
- *result = value;
- return 1;
-}
-