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

Function main

src/wc.c:791–1046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

789
790
791int
792main (int argc, char **argv)
793{
794 int optc;
795 idx_t nfiles;
796 char **files;
797 char *files_from = NULL;
798 struct fstatus *fstatus;
799 struct Tokens tok;
800
801 initialize_main (&argc, &argv);
802 set_program_name (argv[0]);
803 setlocale (LC_ALL, "");
804 bindtextdomain (PACKAGE, LOCALEDIR);
805 textdomain (PACKAGE);
806
807 atexit (close_stdout);
808
809 page_size = getpagesize ();
810 /* Line buffer stdout to ensure lines are written atomically and immediately
811 so that processes running in parallel do not intersperse their output. */
812 setvbuf (stdout, NULL, _IOLBF, 0);
813
814 posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);
815
816 while ((optc = getopt_long (argc, argv, "clLmw", longopts, NULL)) != -1)
817 switch (optc)
818 {
819 case 'c':
820 print_bytes = true;
821 break;
822
823 case 'm':
824 print_chars = true;
825 break;
826
827 case 'l':
828 print_lines = true;
829 break;
830
831 case 'w':
832 print_words = true;
833 break;
834
835 case 'L':
836 print_linelength = true;
837 break;
838
839 case DEBUG_PROGRAM_OPTION:
840 debug = true;
841 break;
842
843 case FILES0_FROM_OPTION:
844 files_from = optarg;
845 break;
846
847 case TOTAL_OPTION:
848 total_mode = XARGMATCH ("--total", optarg, total_args, total_types);

Callers

nothing calls this directly

Calls 7

maybe_c32isnbspaceFunction · 0.85
xalloc_dieFunction · 0.85
get_input_fstatusFunction · 0.85
compute_number_widthFunction · 0.85
wc_fileFunction · 0.85
write_countsFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected