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

Function main

src/paste.c:490–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488}
489
490int
491main (int argc, char **argv)
492{
493 int optc;
494 char const *delim_arg = "\t";
495
496 initialize_main (&argc, &argv);
497 set_program_name (argv[0]);
498 setlocale (LC_ALL, "");
499 bindtextdomain (PACKAGE, LOCALEDIR);
500 textdomain (PACKAGE);
501
502 atexit (close_stdout);
503
504 while ((optc = getopt_long (argc, argv, "d:sz", longopts, NULL)) != -1)
505 {
506 switch (optc)
507 {
508 case 'd':
509 /* Delimiter character(s). */
510 delim_arg = (optarg[0] == '\0' ? "\\0" : optarg);
511 break;
512
513 case 's':
514 serial_merge = true;
515 break;
516
517 case 'z':
518 line_delim = '\0';
519 break;
520
521 case_GETOPT_HELP_CHAR;
522
523 case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
524
525 default:
526 usage (EXIT_FAILURE);
527 }
528 }
529
530 int nfiles = argc - optind;
531 if (nfiles == 0)
532 {
533 argv[optind] = bad_cast ("-");
534 nfiles++;
535 }
536
537 if (collapse_escapes (delim_arg))
538 {
539 /* Don't use the quote() quoting style, because that would double the
540 number of displayed backslashes, making the diagnostic look bogus. */
541 error (EXIT_FAILURE, 0,
542 _("delimiter list ends with an unescaped backslash: %s"),
543 quotearg_n_style_colon (0, c_maybe_quoting_style, delim_arg));
544 }
545
546 bool ok = ((serial_merge ? paste_serial : paste_parallel)
547 (nfiles, &argv[optind]));

Callers

nothing calls this directly

Calls 3

bad_castFunction · 0.85
collapse_escapesFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected