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

Function main

src/nl.c:497–652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495}
496
497int
498main (int argc, char **argv)
499{
500 int c;
501 size_t len;
502 bool ok = true;
503
504 initialize_main (&argc, &argv);
505 set_program_name (argv[0]);
506 setlocale (LC_ALL, "");
507 bindtextdomain (PACKAGE, LOCALEDIR);
508 textdomain (PACKAGE);
509
510 atexit (close_stdout);
511
512 while ((c = getopt_long (argc, argv, "h:b:f:v:i:pl:s:w:n:d:", longopts,
513 NULL))
514 != -1)
515 {
516 switch (c)
517 {
518 case 'h':
519 if (! build_type_arg (&header_type, &header_regex, header_fastmap))
520 {
521 error (0, 0, _("invalid header numbering style: %s"),
522 quote (optarg));
523 ok = false;
524 }
525 break;
526 case 'b':
527 if (! build_type_arg (&body_type, &body_regex, body_fastmap))
528 {
529 error (0, 0, _("invalid body numbering style: %s"),
530 quote (optarg));
531 ok = false;
532 }
533 break;
534 case 'f':
535 if (! build_type_arg (&footer_type, &footer_regex, footer_fastmap))
536 {
537 error (0, 0, _("invalid footer numbering style: %s"),
538 quote (optarg));
539 ok = false;
540 }
541 break;
542 case 'v':
543 starting_line_number = xdectoimax (optarg, INTMAX_MIN, INTMAX_MAX, "",
544 _("invalid starting line number"),
545 0);
546 break;
547 case 'i':
548 page_incr = xdectoimax (optarg, INTMAX_MIN, INTMAX_MAX, "",
549 _("invalid line number increment"), 0);
550 break;
551 case 'p':
552 reset_numbers = false;
553 break;
554 case 'l':

Callers

nothing calls this directly

Calls 3

build_type_argFunction · 0.85
nl_fileFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected