diff options
-rw-r--r-- | config.cc | 2 | ||||
-rw-r--r-- | main.cc | 10 | ||||
-rw-r--r-- | textual.cc | 4 |
3 files changed, 12 insertions, 4 deletions
@@ -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. @@ -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); @@ -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; |