From 6744476198b3d3dfb8ee733cabc205068f3a542e Mon Sep 17 00:00:00 2001 From: Davi de Castro Reis Date: Fri, 8 Jun 2012 11:37:40 -0300 Subject: [PATCH] Minor fixes in command line tool. --- cxxmph/cxxmph.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cxxmph/cxxmph.cc b/cxxmph/cxxmph.cc index b544acd..b13fe59 100644 --- a/cxxmph/cxxmph.cc +++ b/cxxmph/cxxmph.cc @@ -35,7 +35,7 @@ int main(int argc, char** argv) { int verbosity = 0; while (1) { - char ch = (char)getopt(argc, argv, "hv"); + char ch = (char)getopt(argc, argv, "hvV"); if (ch == -1) break; switch (ch) { case 'h': @@ -55,6 +55,10 @@ int main(int argc, char** argv) { } vector keys; ifstream f(argv[optind]); + if (!f.is_open()) { + std::cerr << "Failed to open " << argv[optind] << std::endl; + exit(-1); + } string buffer; while (!getline(f, buffer).eof()) keys.push_back(buffer); for (uint32_t i = 0; i < keys.size(); ++i) string s = keys[i];