summaryrefslogtreecommitdiff
path: root/textual.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2005-09-21 19:46:35 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:18 -0400
commit4819302633e8a7a28176b45f6e99db0827c8a544 (patch)
treecb4836ebfdced1305d7bcd6fa4d8e42e52cb1a2b /textual.cc
parentc0d2ec851db2aa1a0f9ab0df042b9f280db52425 (diff)
downloadledger-4819302633e8a7a28176b45f6e99db0827c8a544.tar.gz
ledger-4819302633e8a7a28176b45f6e99db0827c8a544.tar.bz2
ledger-4819302633e8a7a28176b45f6e99db0827c8a544.zip
(parse_entry): Allow for the possibility that a transaction might end
with EOF.
Diffstat (limited to 'textual.cc')
-rw-r--r--textual.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/textual.cc b/textual.cc
index 1eb3ea9b..51237fe8 100644
--- a/textual.cc
+++ b/textual.cc
@@ -338,17 +338,23 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master,
TIMER_START(entry_xacts);
while (! in.eof() && (in.peek() == ' ' || in.peek() == '\t')) {
+ line[0] = '\0';
in.getline(line, MAX_LINE);
- if (in.eof())
+ if (in.eof() && line[0] == '\0')
break;
+
linenum++;
if (line[0] == ' ' || line[0] == '\t' || line[0] == '\r') {
char * p = skip_ws(line);
if (! *p || *p == '\r')
break;
}
+
if (transaction_t * xact = parse_transaction(line, master))
curr->add_transaction(xact);
+
+ if (in.eof())
+ break;
}
TIMER_STOP(entry_xacts);