summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2016-03-08 11:20:42 -0800
committerMark Spruiell <mes@zeroc.com>2016-03-08 11:20:42 -0800
commitf6c7577915bb2bb5b22e3e5eb68c8b38d1fd95fd (patch)
treeb91b9842d568cd66b45ec1ae301d81a62f50d4c6 /cpp
parentUpdate Copyright for IceStormDB.rc and IceGridDB.rc (diff)
downloadice-f6c7577915bb2bb5b22e3e5eb68c8b38d1fd95fd.tar.bz2
ice-f6c7577915bb2bb5b22e3e5eb68c8b38d1fd95fd.tar.xz
ice-f6c7577915bb2bb5b22e3e5eb68c8b38d1fd95fd.zip
minor fixes to icegriddb/icestormdb
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/IceGrid/IceGridDB.cpp25
-rw-r--r--cpp/src/IceStorm/IceStormDB.cpp22
2 files changed, 24 insertions, 23 deletions
diff --git a/cpp/src/IceGrid/IceGridDB.cpp b/cpp/src/IceGrid/IceGridDB.cpp
index a9814dcb186..8eb7cb0e629 100644
--- a/cpp/src/IceGrid/IceGridDB.cpp
+++ b/cpp/src/IceGrid/IceGridDB.cpp
@@ -153,7 +153,7 @@ Client::usage()
"--dbpath DIR Source or target database environment.\n"
"--mapsize VALUE Set LMDB map size in MB (optional, import only).\n"
"--server-version VER Set Ice version for IceGrid servers (optional, import only).\n"
- "-d, --debug Print debug messages."
+ "-d, --debug Print debug messages.\n"
;
}
@@ -178,7 +178,7 @@ Client::run(int argc, char* argv[])
}
catch(const IceUtilInternal::BadOptException& e)
{
- cerr << e.reason << endl;
+ cerr << argv[0] << ": " << e.reason << endl;
usage();
return EXIT_FAILURE;
}
@@ -203,14 +203,14 @@ Client::run(int argc, char* argv[])
if(!(opts.isSet("import") ^ opts.isSet("export")))
{
- cerr << "Either --import or --export must be set" << endl;
+ cerr << argv[0] << ": either --import or --export must be set" << endl;
usage();
return EXIT_FAILURE;
}
if(!(opts.isSet("dbhome") ^ opts.isSet("dbpath")))
{
- cerr << "Set the database environment directory with either --dbhome or --dbpath" << endl;
+ cerr << argv[0] << ": set the database environment directory with either --dbhome or --dbpath" << endl;
usage();
return EXIT_FAILURE;
}
@@ -247,21 +247,21 @@ Client::run(int argc, char* argv[])
if(!IceUtilInternal::directoryExists(dbPath))
{
- cerr << "Output directory does not exist: " << dbPath << endl;
+ cerr << argv[0] << ": output directory does not exist: " << dbPath << endl;
return EXIT_FAILURE;
}
StringSeq files = IcePatch2Internal::readDirectory(dbPath);
if(!files.empty())
{
- cerr << "Output directory is not empty: " << dbPath << endl;
+ cerr << argv[0] << ": output directory is not empty: " << dbPath << endl;
return EXIT_FAILURE;
}
ifstream fs(dbFile.c_str(), ios::binary);
if(fs.fail())
{
- cerr << "Could not open input file: " << strerror(errno) << endl;
+ cerr << argv[0] << ": could not open input file: " << strerror(errno) << endl;
return EXIT_FAILURE;
}
fs.unsetf(ios::skipws);
@@ -272,7 +272,7 @@ Client::run(int argc, char* argv[])
if(!fileSize)
{
fs.close();
- cerr << "Empty input file" << endl;
+ cerr << argv[0] << ": empty input file" << endl;
return EXIT_FAILURE;
}
@@ -299,7 +299,7 @@ Client::run(int argc, char* argv[])
stream.read(type);
if(type != "IceGrid")
{
- cerr << "Incorrect input file type: " << type << endl;
+ cerr << argv[0] << ": incorrect input file type: " << type << endl;
return EXIT_FAILURE;
}
stream.read(version);
@@ -376,7 +376,8 @@ Client::run(int argc, char* argv[])
IceDB::Dbi<Identity, ObjectInfo, IceDB::IceContext, Ice::OutputStream>
internalObjs(txn, "internal-objects", dbContext, MDB_CREATE);
- for(ObjectInfoSeq::const_iterator p = data.internalObjects.begin(); p != data.internalObjects.end(); ++p)
+ for(ObjectInfoSeq::const_iterator p = data.internalObjects.begin(); p != data.internalObjects.end();
+ ++p)
{
if(debug)
{
@@ -532,7 +533,7 @@ Client::run(int argc, char* argv[])
ofstream fs(dbFile.c_str(), ios::binary);
if(fs.fail())
{
- cerr << "Could not open output file: " << strerror(errno) << endl;
+ cerr << argv[0] << ": could not open output file: " << strerror(errno) << endl;
return EXIT_FAILURE;
}
fs.write(reinterpret_cast<const char*>(stream.b.begin()), stream.b.size());
@@ -541,7 +542,7 @@ Client::run(int argc, char* argv[])
}
catch(const IceUtil::Exception& ex)
{
- cerr << (import ? "Import" : "Export") << " failed:\n" << ex << endl;
+ cerr << argv[0] << ": " << (import ? "import" : "export") << " failed:\n" << ex << endl;
return EXIT_FAILURE;
}
diff --git a/cpp/src/IceStorm/IceStormDB.cpp b/cpp/src/IceStorm/IceStormDB.cpp
index 4cbe2c3995c..2c661b4531c 100644
--- a/cpp/src/IceStorm/IceStormDB.cpp
+++ b/cpp/src/IceStorm/IceStormDB.cpp
@@ -56,7 +56,7 @@ Client::usage()
"--dbhome DIR Source or target database environment.\n"
"--dbpath DIR Source or target database environment.\n"
"--mapsize VALUE Set LMDB map size in MB (optional, import only).\n"
- "-d, --debug Print debug messages."
+ "-d, --debug Print debug messages.\n"
;
}
@@ -80,7 +80,7 @@ Client::run(int argc, char* argv[])
}
catch(const IceUtilInternal::BadOptException& e)
{
- cerr << e.reason << endl;
+ cerr << argv[0] << ": " << e.reason << endl;
usage();
return EXIT_FAILURE;
}
@@ -105,14 +105,14 @@ Client::run(int argc, char* argv[])
if(!(opts.isSet("import") ^ opts.isSet("export")))
{
- cerr << "Either --import or --export must be set" << endl;
+ cerr << argv[0] << ": either --import or --export must be set" << endl;
usage();
return EXIT_FAILURE;
}
if(!(opts.isSet("dbhome") ^ opts.isSet("dbpath")))
{
- cerr << "Set the database environment directory with either --dbhome or --dbpath" << endl;
+ cerr << argv[0] << ": set the database environment directory with either --dbhome or --dbpath" << endl;
usage();
return EXIT_FAILURE;
}
@@ -148,21 +148,21 @@ Client::run(int argc, char* argv[])
if(!IceUtilInternal::directoryExists(dbPath))
{
- cerr << "Output directory does not exist: " << dbPath << endl;
+ cerr << argv[0] << ": output directory does not exist: " << dbPath << endl;
return EXIT_FAILURE;
}
StringSeq files = IcePatch2Internal::readDirectory(dbPath);
if(!files.empty())
{
- cerr << "Output directory is not empty: " << dbPath << endl;
+ cerr << argv[0] << ": output directory is not empty: " << dbPath << endl;
return EXIT_FAILURE;
}
ifstream fs(dbFile.c_str(), ios::binary);
if(fs.fail())
{
- cerr << "Could not open input file: " << strerror(errno) << endl;
+ cerr << argv[0] << ": could not open input file: " << strerror(errno) << endl;
return EXIT_FAILURE;
}
fs.unsetf(ios::skipws);
@@ -173,7 +173,7 @@ Client::run(int argc, char* argv[])
if(!fileSize)
{
fs.close();
- cerr << "Empty input file" << endl;
+ cerr << argv[0] << ": empty input file" << endl;
return EXIT_FAILURE;
}
@@ -192,7 +192,7 @@ Client::run(int argc, char* argv[])
stream.read(type);
if(type != "IceStorm")
{
- cerr << "Incorrect input file type: " << type << endl;
+ cerr << argv[0] << ": incorrect input file type: " << type << endl;
return EXIT_FAILURE;
}
stream.read(version);
@@ -305,7 +305,7 @@ Client::run(int argc, char* argv[])
ofstream fs(dbFile.c_str(), ios::binary);
if(fs.fail())
{
- cerr << "Could not open output file: " << strerror(errno) << endl;
+ cerr << argv[0] << ": could not open output file: " << strerror(errno) << endl;
return EXIT_FAILURE;
}
fs.write(reinterpret_cast<const char*>(stream.b.begin()), stream.b.size());
@@ -314,7 +314,7 @@ Client::run(int argc, char* argv[])
}
catch(const IceUtil::Exception& ex)
{
- cerr << (import ? "Import" : "Export") << " failed:\n" << ex << endl;
+ cerr << argv[0] << ": " << (import ? "import" : "export") << " failed:\n" << ex << endl;
return EXIT_FAILURE;
}