MCPcopy Create free account
hub / github.com/coreutils/coreutils / parse_chunk

Function parse_chunk

src/split.c:1387–1403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1385/* Parse K/N syntax of chunk options. */
1386
1387static void
1388parse_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
1406int

Callers 1

mainFunction · 0.85

Calls 2

parse_n_unitsFunction · 0.85
strtoint_dieFunction · 0.85

Tested by

no test coverage detected