| 1385 | /* Parse K/N syntax of chunk options. */ |
| 1386 | |
| 1387 | static void |
| 1388 | parse_chunk (intmax_t *k_units, intmax_t *n_units, char const *arg) |
| 1389 | { |
| 1390 | char *argend; |
| 1391 | strtol_error e = xstrtoimax (arg, &argend, 10, n_units, ""); |
| 1392 | if (e == LONGINT_INVALID_SUFFIX_CHAR && *argend == '/') |
| 1393 | { |
| 1394 | *k_units = *n_units; |
| 1395 | *n_units = parse_n_units (argend + 1, "", |
| 1396 | N_("invalid number of chunks")); |
| 1397 | if (! (0 < *k_units && *k_units <= *n_units)) |
| 1398 | error (EXIT_FAILURE, 0, "%s: %s", _("invalid chunk number"), |
| 1399 | quote_mem (arg, argend - arg)); |
| 1400 | } |
| 1401 | else if (! (e <= OVERFLOW_OK && 0 < *n_units)) |
| 1402 | strtoint_die (N_("invalid number of chunks"), arg); |
| 1403 | } |
| 1404 | |
| 1405 | |
| 1406 | int |
no test coverage detected