summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.cc2
-rw-r--r--main.cc10
-rw-r--r--textual.cc4
3 files changed, 12 insertions, 4 deletions
diff --git a/config.cc b/config.cc
index 07b1d8b0..437f90e0 100644
--- a/config.cc
+++ b/config.cc
@@ -171,7 +171,7 @@ void config_t::process_options(const std::string& command,
// Process remaining command-line arguments
- if (command != "e" && command != "w") {
+ if (command != "e") {
// Treat the remaining command-line arguments as regular
// expressions, used for refining report results.
diff --git a/main.cc b/main.cc
index 580540d7..d1874f1b 100644
--- a/main.cc
+++ b/main.cc
@@ -323,6 +323,13 @@ int parse_and_report(int argc, char * argv[], char * envp[])
// process the command word and its following arguments
+ std::string first_arg;
+ if (command == "w") {
+ if (arg == args.end())
+ throw error("The 'output' command requires a file argument");
+ first_arg = *arg++;
+ }
+
config.process_options(command, arg, args.end());
std::auto_ptr<entry_t> new_entry;
@@ -389,6 +396,7 @@ int parse_and_report(int argc, char * argv[], char * envp[])
// Compile the format strings
const std::string * format;
+
if (! config.format_string.empty())
format = &config.format_string;
else if (command == "b")
@@ -450,7 +458,7 @@ def vmax(d, val):\n\
formatter = new format_transactions(*out, *format);
if (command == "w") {
- write_textual_journal(*journal, *arg, *formatter, *out);
+ write_textual_journal(*journal, first_arg, *formatter, *out);
} else {
formatter = chain_xact_handlers(command, formatter, journal.get(),
journal->master, formatter_ptrs);
diff --git a/textual.cc b/textual.cc
index e6e39910..10469ab7 100644
--- a/textual.cc
+++ b/textual.cc
@@ -646,8 +646,8 @@ void write_textual_journal(journal_t& journal, std::string path,
throw error(std::string("Journal does not refer to file '") +
found + "'");
- entries_list::iterator el = journal.entries.begin();
- auto_entries_list::iterator al = journal.auto_entries.begin();
+ entries_list::iterator el = journal.entries.begin();
+ auto_entries_list::iterator al = journal.auto_entries.begin();
period_entries_list::iterator pl = journal.period_entries.begin();
istream_pos_type pos = 0;