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

Function main

src/mkdir.c:201–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201int
202main (int argc, char **argv)
203{
204 char const *specified_mode = NULL;
205 int optc;
206 char const *scontext = NULL;
207 struct mkdir_options options;
208
209 options.make_ancestor_function = NULL;
210 options.mode = S_IRWXUGO;
211 options.mode_bits = 0;
212 options.created_directory_format = NULL;
213 options.set_security_context = NULL;
214
215 initialize_main (&argc, &argv);
216 set_program_name (argv[0]);
217 setlocale (LC_ALL, "");
218 bindtextdomain (PACKAGE, LOCALEDIR);
219 textdomain (PACKAGE);
220
221 atexit (close_stdout);
222
223 while ((optc = getopt_long (argc, argv, "pm:vZ", longopts, NULL)) != -1)
224 {
225 switch (optc)
226 {
227 case 'p':
228 options.make_ancestor_function = make_ancestor;
229 break;
230 case 'm':
231 specified_mode = optarg;
232 break;
233 case 'v': /* --verbose */
234 options.created_directory_format = _("created directory %s");
235 break;
236 case 'Z':
237 if (is_smack_enabled ())
238 {
239 /* We don't yet support -Z to restore context with SMACK. */
240 scontext = optarg;
241 }
242 else if (is_selinux_enabled () > 0)
243 {
244 if (optarg)
245 scontext = optarg;
246 else
247 {
248 options.set_security_context = selabel_open (SELABEL_CTX_FILE,
249 NULL, 0);
250 if (! options.set_security_context)
251 error (0, errno, _("warning: ignoring --context"));
252 }
253 }
254 else if (optarg)
255 {
256 error (0, 0,
257 _("warning: ignoring --context; "
258 "it requires an SELinux/SMACK-enabled kernel"));

Callers

nothing calls this directly

Calls 3

is_smack_enabledFunction · 0.85
smack_set_label_for_selfFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected