summaryrefslogtreecommitdiff
path: root/reports.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2003-10-09 01:19:46 +0000
committerJohn Wiegley <johnw@newartisans.com>2003-10-09 01:19:46 +0000
commit2835be562889c4e4dd11205533cca54ae02042e1 (patch)
tree8bcd6823bd699b7d2b0c2db889703902a1c7eb7e /reports.cc
parent73744e9d266003344f01d2ba63e159f0c3a2b314 (diff)
downloadfork-ledger-2835be562889c4e4dd11205533cca54ae02042e1.tar.gz
fork-ledger-2835be562889c4e4dd11205533cca54ae02042e1.tar.bz2
fork-ledger-2835be562889c4e4dd11205533cca54ae02042e1.zip
*** empty log message ***
Diffstat (limited to 'reports.cc')
-rw-r--r--reports.cc18
1 files changed, 2 insertions, 16 deletions
diff --git a/reports.cc b/reports.cc
index da33f42f..b46d360e 100644
--- a/reports.cc
+++ b/reports.cc
@@ -167,23 +167,8 @@ static std::string truncated(const std::string& str, int width)
void print_register(const std::string& acct_name, std::ostream& out,
regexps_map& regexps)
{
- account * acct = NULL;
mask acct_regex(acct_name);
- for (accounts_map_iterator i = main_ledger->accounts.begin();
- i != main_ledger->accounts.end();
- i++)
- if (acct_regex.match((*i).second->as_str())) {
- acct = (*i).second;
- break;
- }
-
- if (! acct) {
- std::cerr << "Error: Unknown account name: " << acct_name
- << std::endl;
- return;
- }
-
// Walk through all of the ledger entries, printing their register
// formatted equivalent
@@ -198,7 +183,8 @@ void print_register(const std::string& acct_name, std::ostream& out,
for (std::list<transaction *>::iterator x = (*i)->xacts.begin();
x != (*i)->xacts.end();
x++) {
- if ((*x)->acct != acct || ! show_cleared && (*i)->cleared)
+ if (! acct_regex.match((*x)->acct->as_str()) ||
+ ! show_cleared && (*i)->cleared)
continue;
char buf[32];