summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2005-07-12 21:36:03 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:14 -0400
commite00c568addfc173d7dc584b1d9cd985b403e297d (patch)
tree778a2570c26941c571215183d30fae902c6af053
parent4e822d213f29b0698b0b6d72286ff77fa37216d8 (diff)
downloadfork-ledger-e00c568addfc173d7dc584b1d9cd985b403e297d.tar.gz
fork-ledger-e00c568addfc173d7dc584b1d9cd985b403e297d.tar.bz2
fork-ledger-e00c568addfc173d7dc584b1d9cd985b403e297d.zip
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.
-rw-r--r--config.cc7
1 files changed, 3 insertions, 4 deletions
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);