diff options
author | Jan Huwald <jh@sotun.de> | 2014-02-16 17:02:53 (GMT) |
---|---|---|
committer | Jan Huwald <jh@sotun.de> | 2014-02-16 17:02:53 (GMT) |
commit | 151f06f7bd8780f7bf42b008d2991a1824c79d90 (patch) | |
tree | dfdebb50f52ad41d248786fc2de7de15e0898440 /src/handle_dep.cc | |
parent | e2f51279257dc7bd85497be629ed7337c1fa2881 (diff) |
refractor command line parsing
- handle optional values with boost::optional<string> instead of char
- handle -o/-s/-x without code duplication
Diffstat (limited to 'src/handle_dep.cc')
-rw-r--r-- | src/handle_dep.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/handle_dep.cc b/src/handle_dep.cc index 2d6f3ff..1e8b3c2 100644 --- a/src/handle_dep.cc +++ b/src/handle_dep.cc @@ -10,7 +10,7 @@ namespace fs = boost::filesystem; #include "boosty.h" boost::unordered_set<std::string> dependencies; -const char *make_command = NULL; +boost::optional<std::string> make_command; void handle_dep(const std::string &filename) { @@ -23,7 +23,7 @@ void handle_dep(const std::string &filename) } if (!fs::exists(filepath) && make_command) { std::stringstream buf; - buf << make_command << " '" << boost::regex_replace(filename, boost::regex("'"), "'\\''") << "'"; + buf << *make_command << " '" << boost::regex_replace(filename, boost::regex("'"), "'\\''") << "'"; system(buf.str().c_str()); // FIXME: Handle error } } |