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

Function main

src/date.c:467–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465}
466
467int
468main (int argc, char **argv)
469{
470 char const *datestr = NULL;
471 char const *set_datestr = NULL;
472 bool set_date = false;
473 char const *format = NULL;
474 bool format_in_c_locale = false;
475 bool get_resolution = false;
476 char *batch_file = NULL;
477 char *reference = NULL;
478 bool discarded_datestr = false;
479 bool discarded_set_datestr = false;
480 char const *tzstring = NULL;
481
482 initialize_main (&argc, &argv);
483 set_program_name (argv[0]);
484 setlocale (LC_ALL, "");
485 bindtextdomain (PACKAGE, LOCALEDIR);
486 textdomain (PACKAGE);
487
488 atexit (close_stdout);
489
490 int optc;
491 while ((optc = getopt_long (argc, argv, short_options, long_options, NULL))
492 != -1)
493 {
494 switch (optc)
495 {
496 case 'd':
497 if (datestr)
498 discarded_datestr = true;
499 datestr = optarg;
500 break;
501 case DEBUG_DATE_PARSING_OPTION:
502 parse_datetime_flags |= PARSE_DATETIME_DEBUG;
503 break;
504 case 'f':
505 batch_file = optarg;
506 break;
507 case RESOLUTION_OPTION:
508 get_resolution = true;
509 break;
510 case RFC_3339_OPTION:
511 {
512 static char const rfc_3339_format[][32] =
513 {
514 "%Y-%m-%d",
515 "%Y-%m-%d %H:%M:%S%:z",
516 "%Y-%m-%d %H:%M:%S.%N%:z"
517 };
518 enum Time_spec i =
519 XARGMATCH ("--rfc-3339", optarg,
520 time_spec_string + 2, time_spec + 2);
521 format = rfc_3339_format[i];
522 format_in_c_locale = true;
523 break;
524 }

Callers

nothing calls this directly

Calls 5

adjust_resolutionFunction · 0.85
batch_convertFunction · 0.85
show_date_helperFunction · 0.85
usageFunction · 0.70
statClass · 0.70

Tested by

no test coverage detected