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

Function main

src/cat.c:681–975  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

679}
680
681int
682main (int argc, char **argv)
683{
684 /* Nonzero if we have ever read standard input. */
685 bool have_read_stdin = false;
686
687 struct stat ostat_buf;
688
689 /* Variables that are set according to the specified options. */
690 bool number = false;
691 bool number_nonblank = false;
692 bool squeeze_blank = false;
693 bool show_ends = false;
694 bool show_nonprinting = false;
695 bool show_tabs = false;
696 int file_open_mode = O_RDONLY;
697
698 static struct option const long_options[] =
699 {
700 {"number-nonblank", no_argument, NULL, 'b'},
701 {"number", no_argument, NULL, 'n'},
702 {"squeeze-blank", no_argument, NULL, 's'},
703 {"show-nonprinting", no_argument, NULL, 'v'},
704 {"show-ends", no_argument, NULL, 'E'},
705 {"show-tabs", no_argument, NULL, 'T'},
706 {"show-all", no_argument, NULL, 'A'},
707 {GETOPT_HELP_OPTION_DECL},
708 {GETOPT_VERSION_OPTION_DECL},
709 {NULL, 0, NULL, 0}
710 };
711
712 initialize_main (&argc, &argv);
713 set_program_name (argv[0]);
714 setlocale (LC_ALL, "");
715 bindtextdomain (PACKAGE, LOCALEDIR);
716 textdomain (PACKAGE);
717
718 /* Arrange to close stdout if we exit via the
719 case_GETOPT_HELP_CHAR or case_GETOPT_VERSION_CHAR code.
720 Normally STDOUT_FILENO is used rather than stdout, so
721 close_stdout does nothing. */
722 atexit (close_stdout);
723
724 /* Parse command line options. */
725
726 int c;
727 while ((c = getopt_long (argc, argv, "benstuvAET", long_options, NULL))
728 != -1)
729 {
730 switch (c)
731 {
732 case 'b':
733 number = true;
734 number_nonblank = true;
735 break;
736
737 case 'e':
738 show_ends = true;

Callers

nothing calls this directly

Calls 11

io_blksizeFunction · 0.85
fdadviseFunction · 0.85
copy_catFunction · 0.85
usable_st_sizeFunction · 0.85
splice_catFunction · 0.85
ensure_buf_sizeFunction · 0.85
simple_catFunction · 0.85
xalloc_dieFunction · 0.85
catFunction · 0.85
write_errorFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected