summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cc18
-rw-r--r--src/session.cc4
-rw-r--r--src/textual.cc10
-rw-r--r--src/utils.cc4
-rw-r--r--src/utils.h4
5 files changed, 25 insertions, 15 deletions
diff --git a/src/main.cc b/src/main.cc
index f70d0bd9..99f1ff93 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -57,16 +57,17 @@ static int read_and_report(report_t * report, int argc, char * argv[],
process_environment(const_cast<const char **>(envp), "LEDGER_", report);
TRACE_FINISH(environment, 1);
- const char * p = std::getenv("HOME");
- path home = p ? p : "";
+ optional<path> home;
+ if (const char * home_var = std::getenv("HOME"))
+ home = home_var;
if (! session.init_file)
- session.init_file = home / ".ledgerrc";
+ session.init_file = home ? *home / ".ledgerrc" : "./.ledgerrc";
if (! session.price_db)
- session.price_db = home / ".pricedb";
+ session.price_db = home ? *home / ".pricedb" : "./.pricedb";
if (! session.cache_file)
- session.cache_file = home / ".ledger-cache";
+ session.cache_file = home ? *home / ".ledger-cache" : "./.ledger-cache";
if (session.data_file == *session.cache_file)
session.use_cache = false;
@@ -392,6 +393,11 @@ int main(int argc, char * argv[], char * envp[])
if (std::strcmp(argv[i], "--verify") == 0)
ledger::verify_enabled = true;
#endif
+#if defined(LOGGING_ON)
+ if (std::strcmp(argv[i], "--verbose") == 0 ||
+ std::strcmp(argv[i], "-v") == 0)
+ ledger::_log_level = LOG_INFO;
+#endif
#if defined(DEBUG_ON)
if (i + 1 < argc && std::strcmp(argv[i], "--debug") == 0) {
ledger::_log_level = LOG_DEBUG;
@@ -410,6 +416,8 @@ int main(int argc, char * argv[], char * envp[])
try {
std::ios::sync_with_stdio(false);
+ boost::filesystem::path::default_name_check
+ (boost::filesystem::portable_posix_name);
ledger::initialize();
diff --git a/src/session.cc b/src/session.cc
index ecbc929f..5f452f25 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -218,10 +218,10 @@ void shutdown()
amount_t::shutdown();
IF_VERIFY() {
- INFO("Ledger shutdown (Boost/libstdc++ may still hold memory)");
+ INFO("Ledger ended (Boost/libstdc++ may still hold memory)");
shutdown_memory_tracing();
} else {
- INFO("Ledger shutdown");
+ INFO("Ledger ended");
}
}
diff --git a/src/textual.cc b/src/textual.cc
index 7d1d224e..9c9c931f 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -690,8 +690,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
i != time_entries.end();
i++)
if (event.account == (*i).account)
- throw_(parse_error,
- "Cannot double check-in to the same account");
+ throw_(parse_error, "Cannot double check-in to the same account");
time_entries.push_back(event);
break;
@@ -839,9 +838,12 @@ unsigned int textual_parser_t::parse(std::istream& in,
push_var<unsigned long> save_end_pos(end_pos);
push_var<unsigned int> save_linenum(linenum);
- pathname = resolve_path(pathname);
+ if (*p != '~' && *p != '/')
+ pathname = (pathname.branch_path() / path(p)).normalize();
+ else
+ pathname = resolve_path(p);
- DEBUG("ledger.textual.include", "line " << linenum << ": " <<
+ DEBUG("ledger.textual.include", "Line " << linenum << ": " <<
"Including path '" << pathname.string() << "'");
include_stack.push_back
diff --git a/src/utils.cc b/src/utils.cc
index f18ccca1..59028141 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -404,7 +404,7 @@ string::~string() {
namespace ledger {
-log_level_t _log_level;
+log_level_t _log_level = LOG_WARN;
std::ostream * _log_stream = &std::cerr;
std::ostringstream _log_buffer;
@@ -497,7 +497,7 @@ bool logger_func(log_level_t level)
namespace ledger {
-std::string _log_category;
+optional<std::string> _log_category;
} // namespace ledger
diff --git a/src/utils.h b/src/utils.h
index 89b9a2d0..65071035 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -238,10 +238,10 @@ extern unsigned int _trace_level;
#if defined(DEBUG_ON)
-extern std::string _log_category;
+extern optional<std::string> _log_category;
inline bool category_matches(const char * cat) {
- return starts_with(_log_category, cat);
+ return _log_category && starts_with(cat, *_log_category);
}
#define SHOW_DEBUG(cat) \