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

Function main

src/split.c:1406–1758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1404
1405
1406int
1407main (int argc, char **argv)
1408{
1409 enum Split_type split_type = type_undef;
1410 idx_t in_blk_size = 0; /* optimal block size of input file device */
1411 idx_t page_size = getpagesize ();
1412 intmax_t k_units = 0;
1413 intmax_t n_units = 0;
1414
1415 static char const multipliers[] = "bEGKkMmPQRTYZ0";
1416 int c;
1417 int digits_optind = 0;
1418 off_t file_size = OFF_T_MAX;
1419
1420 initialize_main (&argc, &argv);
1421 set_program_name (argv[0]);
1422 setlocale (LC_ALL, "");
1423 bindtextdomain (PACKAGE, LOCALEDIR);
1424 textdomain (PACKAGE);
1425
1426 atexit (close_stdout);
1427
1428 /* Parse command line options. */
1429
1430 while (true)
1431 {
1432 /* This is the argv-index of the option we will read next. */
1433 int this_optind = optind ? optind : 1;
1434
1435 c = getopt_long (argc, argv, "0123456789C:a:b:del:n:t:ux",
1436 longopts, NULL);
1437 if (c == -1)
1438 break;
1439
1440 switch (c)
1441 {
1442 case 'a':
1443 suffix_length = xdectoimax (optarg, 0, IDX_MAX,
1444 "", _("invalid suffix length"), 0);
1445 break;
1446
1447 case ADDITIONAL_SUFFIX_OPTION:
1448 {
1449 int suffix_len = strlen (optarg);
1450 if (last_component (optarg) != optarg
1451 || (suffix_len && ISSLASH (optarg[suffix_len - 1])))
1452 {
1453 error (0, 0,
1454 _("invalid suffix %s, contains directory separator"),
1455 quote (optarg));
1456 usage (EXIT_FAILURE);
1457 }
1458 }
1459 additional_suffix = optarg;
1460 break;
1461
1462 case 'b':
1463 if (split_type != type_undef)

Callers

nothing calls this directly

Calls 15

parse_n_unitsFunction · 0.85
to_ucharFunction · 0.85
parse_chunkFunction · 0.85
set_suffix_lengthFunction · 0.85
fd_reopenFunction · 0.85
fdadviseFunction · 0.85
io_blksizeFunction · 0.85
input_file_sizeFunction · 0.85
lines_splitFunction · 0.85
bytes_splitFunction · 0.85
line_bytes_splitFunction · 0.85
bytes_chunk_extractFunction · 0.85

Tested by

no test coverage detected