From f3c736006c72cefaad52981420e3aabf88b271db Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 9 Feb 2005 10:07:40 +0000 Subject: *** empty log message *** --- config.cc | 2 ++ config.h | 1 + format.cc | 2 +- main.cc | 6 +++++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config.cc b/config.cc index fdee03e5..8bdbc4e1 100644 --- a/config.cc +++ b/config.cc @@ -44,6 +44,7 @@ config_t::config_t() prices_format = ("%[%Y/%m/%d %H:%M:%S %Z] %-8A " "%10t %10(@vmin(t)) %10(@vmax(t)) %12T\n"); #endif + pricesdb_format = "P %[%Y/%m/%d %H:%M:%S] %A %t\n"; show_collapsed = false; show_subtotal = false; @@ -981,6 +982,7 @@ void export_config() .def_readwrite("write_xact_format", &config_t::write_xact_format) .def_readwrite("equity_format", &config_t::equity_format) .def_readwrite("prices_format", &config_t::prices_format) + .def_readwrite("pricesdb_format", &config_t::pricesdb_format) .def_readwrite("date_format", &config_t::date_format) .def_readwrite("sort_string", &config_t::sort_string) .def_readwrite("amount_expr", &config_t::amount_expr) diff --git a/config.h b/config.h index 43248a30..ab6ff9df 100644 --- a/config.h +++ b/config.h @@ -40,6 +40,7 @@ struct config_t std::string write_xact_format; std::string equity_format; std::string prices_format; + std::string pricesdb_format; std::string date_format; std::string sort_string; std::string amount_expr; diff --git a/format.cc b/format.cc index 7d1748c1..f5259e93 100644 --- a/format.cc +++ b/format.cc @@ -329,7 +329,7 @@ void format_t::format(std::ostream& out_str, const details_t& details) const break; case element_t::SOURCE: - if (details.entry) { + if (details.entry && details.entry->journal) { int idx = details.entry->src_idx; for (strings_list::iterator i = details.entry->journal->sources.begin(); i != details.entry->journal->sources.end(); diff --git a/main.cc b/main.cc index 9c266c19..f01b60b1 100644 --- a/main.cc +++ b/main.cc @@ -248,6 +248,8 @@ int parse_and_report(int argc, char * argv[], char * envp[]) command = "E"; else if (command == "prices") command = "P"; + else if (command == "pricesdb") + command = "D"; else if (command == "reconcile") command = "R"; else @@ -317,6 +319,8 @@ int parse_and_report(int argc, char * argv[], char * envp[]) format = &config.equity_format; else if (command == "P") format = &config.prices_format; + else if (command == "D") + format = &config.pricesdb_format; else if (command == "w") format = &config.write_xact_format; else @@ -368,7 +372,7 @@ def vmax(d, val):\n\ if (command == "e") walk_transactions(new_entry->transactions, *formatter); - else if (command == "P") + else if (command == "P" || command == "D") walk_commodities(commodity_t::commodities, *formatter); else if (command == "R") reconcile_account(*journal, *journal->master, value_t(long(0))); -- cgit v1.2.3