diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/common_logging.c | 4 | ||||
-rw-r--r-- | src/util/getopt_helpers.c | 32 |
2 files changed, 31 insertions, 5 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 27ac88a05..527dffc02 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -705,7 +705,9 @@ parse_all_definitions () | |||
705 | * @return #GNUNET_OK on success | 705 | * @return #GNUNET_OK on success |
706 | */ | 706 | */ |
707 | int | 707 | int |
708 | GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile) | 708 | GNUNET_log_setup (const char *comp, |
709 | const char *loglevel, | ||
710 | const char *logfile) | ||
709 | { | 711 | { |
710 | const char *env_logfile; | 712 | const char *env_logfile; |
711 | 713 | ||
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c index a2572ccab..f053158ae 100644 --- a/src/util/getopt_helpers.c +++ b/src/util/getopt_helpers.c | |||
@@ -623,18 +623,42 @@ set_timetravel_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
623 | const char *value) | 623 | const char *value) |
624 | { | 624 | { |
625 | long long delta; | 625 | long long delta; |
626 | long long minus; | ||
627 | struct GNUNET_TIME_Relative rt; | ||
626 | 628 | ||
627 | (void) scls; | 629 | (void) scls; |
628 | (void) ctx; | 630 | (void) ctx; |
629 | if (1 != sscanf (value, | 631 | while (isspace (value[0])) |
630 | "%lld", | 632 | value++; |
631 | &delta)) | 633 | minus = 1; |
634 | if (value[0] == '-') | ||
635 | { | ||
636 | minus = -1; | ||
637 | value++; | ||
638 | } | ||
639 | else if (value[0] == '+') | ||
640 | { | ||
641 | value++; | ||
642 | } | ||
643 | if (GNUNET_OK != | ||
644 | GNUNET_STRINGS_fancy_time_to_relative (value, | ||
645 | &rt)) | ||
632 | { | 646 | { |
633 | fprintf (stderr, | 647 | fprintf (stderr, |
634 | _ ("You must pass a number to the `%s' option.\n"), | 648 | _ ( |
649 | "You must pass a relative time (optionally with sign) to the `%s' option.\n"), | ||
650 | option); | ||
651 | return GNUNET_SYSERR; | ||
652 | } | ||
653 | if (rt.rel_value_us > LONG_LONG_MAX) | ||
654 | { | ||
655 | fprintf (stderr, | ||
656 | _ ("Value given for time travel `%s' option is too big.\n"), | ||
635 | option); | 657 | option); |
636 | return GNUNET_SYSERR; | 658 | return GNUNET_SYSERR; |
637 | } | 659 | } |
660 | delta = (long long) rt.rel_value_us; | ||
661 | delta *= minus; | ||
638 | GNUNET_TIME_set_offset (delta); | 662 | GNUNET_TIME_set_offset (delta); |
639 | return GNUNET_OK; | 663 | return GNUNET_OK; |
640 | } | 664 | } |