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

Function main

src/env.c:761–934  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

759}
760
761int
762main (int argc, char **argv)
763{
764 bool ignore_environment = false;
765 bool opt_nul_terminate_output = false;
766 char const *newdir = NULL;
767 char *argv0 = NULL;
768
769 initialize_main (&argc, &argv);
770 set_program_name (argv[0]);
771 setlocale (LC_ALL, "");
772 bindtextdomain (PACKAGE, LOCALEDIR);
773 textdomain (PACKAGE);
774
775 initialize_exit_failure (EXIT_CANCELED);
776 atexit (close_stdout);
777
778 initialize_signals ();
779
780 int optc;
781 while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
782 {
783 switch (optc)
784 {
785 case 'a':
786 argv0 = optarg;
787 break;
788 case 'i':
789 ignore_environment = true;
790 break;
791 case 'u':
792 append_unset_var (optarg);
793 break;
794 case 'v':
795 dev_debug = true;
796 break;
797 case '0':
798 opt_nul_terminate_output = true;
799 break;
800 case DEFAULT_SIGNAL_OPTION:
801 parse_signal_action_params (optarg, true);
802 parse_block_signal_params (optarg, false);
803 break;
804 case IGNORE_SIGNAL_OPTION:
805 parse_signal_action_params (optarg, false);
806 break;
807 case BLOCK_SIGNAL_OPTION:
808 parse_block_signal_params (optarg, true);
809 break;
810 case LIST_SIGNAL_HANDLING_OPTION:
811 report_signal_handling = true;
812 break;
813 case 'C':
814 newdir = optarg;
815 break;
816 case 'S':
817 parse_split_string (optarg, &optind, &argc, &argv);
818 break;

Callers

nothing calls this directly

Calls 11

initialize_exit_failureFunction · 0.85
initialize_signalsFunction · 0.85
append_unset_varFunction · 0.85
parse_split_stringFunction · 0.85
unset_envvarsFunction · 0.85
reset_signal_handlersFunction · 0.85
set_signal_proc_maskFunction · 0.85
list_signal_handlingFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected