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

Function main

src/rm.c:233–396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233int
234main (int argc, char **argv)
235{
236 bool preserve_root = true;
237 struct rm_options x;
238 bool prompt_once = false;
239 int c;
240
241 initialize_main (&argc, &argv);
242 set_program_name (argv[0]);
243 setlocale (LC_ALL, "");
244 bindtextdomain (PACKAGE, LOCALEDIR);
245 textdomain (PACKAGE);
246
247 atexit (close_stdin);
248
249 rm_option_init (&x);
250
251 /* Try to disable the ability to unlink a directory. */
252 priv_set_remove_linkdir ();
253
254 while ((c = getopt_long (argc, argv, "dfirvIR", long_opts, NULL)) != -1)
255 {
256 switch (c)
257 {
258 case 'd':
259 x.remove_empty_directories = true;
260 break;
261
262 case 'f':
263 x.interactive = RMI_NEVER;
264 x.ignore_missing_files = true;
265 prompt_once = false;
266 break;
267
268 case 'i':
269 x.interactive = RMI_ALWAYS;
270 x.ignore_missing_files = false;
271 prompt_once = false;
272 break;
273
274 case 'I':
275 x.interactive = RMI_SOMETIMES;
276 x.ignore_missing_files = false;
277 prompt_once = true;
278 break;
279
280 case 'r':
281 case 'R':
282 x.recursive = true;
283 break;
284
285 case INTERACTIVE_OPTION:
286 {
287 int i;
288 if (optarg)
289 i = XARGMATCH ("--interactive", optarg, interactive_args,
290 interactive_types);

Callers

nothing calls this directly

Calls 6

diagnose_leading_hyphenFunction · 0.85
get_root_dev_inoFunction · 0.85
select_pluralFunction · 0.85
rmFunction · 0.85
rm_option_initFunction · 0.70
usageFunction · 0.70

Tested by

no test coverage detected