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

Function main

src/cp.c:1028–1336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1026}
1027
1028int
1029main (int argc, char **argv)
1030{
1031 bool make_backups = false;
1032 char const *backup_suffix = NULL;
1033 char *version_control_string = NULL;
1034 struct cp_options x;
1035 bool copy_contents = false;
1036 char *target_directory = NULL;
1037 bool no_target_directory = false;
1038 char const *scontext = NULL;
1039
1040 initialize_main (&argc, &argv);
1041 set_program_name (argv[0]);
1042 setlocale (LC_ALL, "");
1043 bindtextdomain (PACKAGE, LOCALEDIR);
1044 textdomain (PACKAGE);
1045
1046 atexit (close_stdin);
1047
1048 selinux_enabled = (0 < is_selinux_enabled ());
1049 cp_option_init (&x);
1050
1051 int c;
1052 while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:TZ",
1053 long_opts, NULL))
1054 != -1)
1055 {
1056 switch (c)
1057 {
1058 case SPARSE_OPTION:
1059 x.sparse_mode = XARGMATCH ("--sparse", optarg,
1060 sparse_type_string, sparse_type);
1061 break;
1062
1063 case REFLINK_OPTION:
1064 if (optarg == NULL)
1065 x.reflink_mode = REFLINK_ALWAYS;
1066 else
1067 x.reflink_mode = XARGMATCH ("--reflink", optarg,
1068 reflink_type_string, reflink_type);
1069 break;
1070
1071 case 'a':
1072 /* Like -dR --preserve=all with reduced failure diagnostics. */
1073 x.dereference = DEREF_NEVER;
1074 x.preserve_links = true;
1075 x.preserve_ownership = true;
1076 x.preserve_mode = true;
1077 x.preserve_timestamps = true;
1078 x.require_preserve = true;
1079 if (selinux_enabled)
1080 x.preserve_security_context = true;
1081 x.preserve_xattr = true;
1082 x.reduce_diagnostics = true;
1083 x.recursive = true;
1084 break;
1085

Callers

nothing calls this directly

Calls 5

decode_preserve_argFunction · 0.85
hash_initFunction · 0.85
do_copyFunction · 0.85
cp_option_initFunction · 0.70
usageFunction · 0.70

Tested by

no test coverage detected