| 800 | using option +FIRST_PAGE:LAST_PAGE */ |
| 801 | |
| 802 | static bool |
| 803 | first_last_page (int oi, char c, char const *pages) |
| 804 | { |
| 805 | char *p; |
| 806 | uintmax_t first; |
| 807 | uintmax_t last = UINTMAX_MAX; |
| 808 | strtol_error err = xstrtoumax (pages, &p, 10, &first, ""); |
| 809 | if (err != LONGINT_OK && err != LONGINT_INVALID_SUFFIX_CHAR) |
| 810 | xstrtol_fatal (err, oi, c, long_options, pages); |
| 811 | |
| 812 | if (p == pages || !first) |
| 813 | return false; |
| 814 | |
| 815 | if (*p == ':') |
| 816 | { |
| 817 | char const *p1 = p + 1; |
| 818 | err = xstrtoumax (p1, &p, 10, &last, ""); |
| 819 | if (err != LONGINT_OK) |
| 820 | xstrtol_fatal (err, oi, c, long_options, pages); |
| 821 | if (p1 == p || last < first) |
| 822 | return false; |
| 823 | } |
| 824 | |
| 825 | if (*p) |
| 826 | return false; |
| 827 | |
| 828 | first_page_number = first; |
| 829 | last_page_number = last; |
| 830 | return true; |
| 831 | } |
| 832 | |
| 833 | /* Parse column count string S, and if it's valid (1 or larger and |
| 834 | within range of the type of 'columns') set the global variables |