From e00c568addfc173d7dc584b1d9cd985b403e297d Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 12 Jul 2005 21:36:03 +0000 Subject: When --input-date-format is seen, don't wipe out the rest of the date formats, simply replace the first one. Then, when --period is seen, use the first date format as the template for what to pass to the begin/end options. --- config.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'config.cc') diff --git a/config.cc b/config.cc index 7434fb1b..0e9d3c74 100644 --- a/config.cc +++ b/config.cc @@ -692,7 +692,6 @@ OPT_BEGIN(date_format, "y:") { OPT_BEGIN(input_date_format, ":") { std::strcpy(input_format, optarg); formats[0] = input_format; - formats[1] = NULL; } OPT_END(input_date_format); OPT_BEGIN(balance_format, ":") { @@ -787,14 +786,14 @@ OPT_BEGIN(period, "p:") { // modify the calculation predicate (via the --begin and --end // options) to take this into account. - char buf[32]; + char buf[128]; interval_t interval(config.report_period); if (interval.begin) { - std::strftime(buf, 31, "%Y/%m/%d", std::localtime(&interval.begin)); + std::strftime(buf, 127, formats[0], std::localtime(&interval.begin)); process_option(config_options, "begin", buf); } if (interval.end) { - std::strftime(buf, 31, "%Y/%m/%d", std::localtime(&interval.end)); + std::strftime(buf, 127, formats[0], std::localtime(&interval.end)); process_option(config_options, "end", buf); } } OPT_END(period); -- cgit v1.2.3