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

Function main

src/seq.c:549–704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

547}
548
549int
550main (int argc, char **argv)
551{
552 /* The printf(3) format used for output. */
553 char const *format_str = NULL;
554
555 initialize_main (&argc, &argv);
556 set_program_name (argv[0]);
557 locale_ok = !!setlocale (LC_ALL, "");
558 bindtextdomain (PACKAGE, LOCALEDIR);
559 textdomain (PACKAGE);
560
561 atexit (close_stdout);
562
563 /* We have to handle negative numbers in the command line but this
564 conflicts with the command line arguments. So explicitly check first
565 whether the next argument looks like a negative number. */
566 while (optind < argc)
567 {
568 int optc;
569 if (argv[optind][0] == '-'
570 && ((optc = argv[optind][1]) == '.' || c_isdigit (optc)))
571 {
572 /* means negative number */
573 break;
574 }
575
576 optc = getopt_long (argc, argv, "+f:s:w", long_options, NULL);
577 if (optc == -1)
578 break;
579
580 switch (optc)
581 {
582 case 'f':
583 format_str = optarg;
584 break;
585
586 case 's':
587 separator = optarg;
588 break;
589
590 case 'w':
591 equal_width = true;
592 break;
593
594 case_GETOPT_HELP_CHAR;
595
596 case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
597
598 default:
599 usage (EXIT_FAILURE);
600 }
601 }
602
603 int n_args = argc - optind;
604 if (n_args < 1)
605 {
606 error (0, 0, _("missing operand"));

Callers

nothing calls this directly

Calls 7

long_double_formatFunction · 0.85
all_digits_pFunction · 0.85
seq_fastFunction · 0.85
scan_argFunction · 0.85
get_default_formatFunction · 0.85
print_numbersFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected