[Box Backup-commit] COMMIT r1690 - in box/chris/general/bin: bbackupctl bbackupd bbackupquery bbstoreaccounts bbstored
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Sat, 26 May 2007 16:33:26 +0100
Author: chris
Date: 2007-05-26 16:33:26 +0100 (Sat, 26 May 2007)
New Revision: 1690
Modified:
box/chris/general/bin/bbackupctl/bbackupctl.cpp
box/chris/general/bin/bbackupd/bbackupd.cpp
box/chris/general/bin/bbackupquery/bbackupquery.cpp
box/chris/general/bin/bbstoreaccounts/bbstoreaccounts.cpp
box/chris/general/bin/bbstored/bbstored.cpp
Log:
Determine config file location at runtime instead of hard-coding on
Windows. Thanks to Paul MacKenzie, Per Thomsen, Pete Jalajas, Stuart
Sanders, Dave Bamford and Gary for pushing me to do this. (fixes #12)
Modified: box/chris/general/bin/bbackupctl/bbackupctl.cpp
===================================================================
--- box/chris/general/bin/bbackupctl/bbackupctl.cpp 2007-05-26 15:30:37 UTC (rev 1689)
+++ box/chris/general/bin/bbackupctl/bbackupctl.cpp 2007-05-26 15:33:26 UTC (rev 1690)
@@ -66,7 +66,13 @@
#endif
// Filename for configuration file?
- const char *configFilename = BOX_FILE_BBACKUPD_DEFAULT_CONFIG;
+ std::string configFilename;
+
+ #ifdef WIN32
+ configFilename = BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE;
+ #else
+ configFilename = BOX_FILE_BBACKUPD_DEFAULT_CONFIG;
+ #endif
// Quiet?
bool quiet = false;
@@ -103,9 +109,14 @@
}
// Read in the configuration file
- if(!quiet) printf("Using configuration file %s\n", configFilename);
+ if(!quiet) printf("Using configuration file %s\n",
+ configFilename.c_str());
+
std::string errs;
- std::auto_ptr<Configuration> config(Configuration::LoadAndVerify(configFilename, &BackupDaemonConfigVerify, errs));
+ std::auto_ptr<Configuration> config(
+ Configuration::LoadAndVerify
+ (configFilename, &BackupDaemonConfigVerify, errs));
+
if(config.get() == 0 || !errs.empty())
{
printf("Invalid configuration file:\n%s", errs.c_str());
Modified: box/chris/general/bin/bbackupd/bbackupd.cpp
===================================================================
--- box/chris/general/bin/bbackupd/bbackupd.cpp 2007-05-26 15:30:37 UTC (rev 1689)
+++ box/chris/general/bin/bbackupd/bbackupd.cpp 2007-05-26 15:33:26 UTC (rev 1690)
@@ -89,7 +89,7 @@
else
{
ExitCode = gpDaemonService->Main(
- BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv);
+ BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE, argc, argv);
}
delete gpDaemonService;
Modified: box/chris/general/bin/bbackupquery/bbackupquery.cpp
===================================================================
--- box/chris/general/bin/bbackupquery/bbackupquery.cpp 2007-05-26 15:30:37 UTC (rev 1689)
+++ box/chris/general/bin/bbackupquery/bbackupquery.cpp 2007-05-26 15:33:26 UTC (rev 1690)
@@ -66,7 +66,8 @@
{
int returnCode = 0;
- MAINHELPER_SETUP_MEMORY_LEAK_EXIT_REPORT("bbackupquery.memleaks", "bbackupquery")
+ MAINHELPER_SETUP_MEMORY_LEAK_EXIT_REPORT("bbackupquery.memleaks",
+ "bbackupquery")
MAINHELPER_START
#ifdef WIN32
@@ -77,7 +78,7 @@
if (WSAStartup(0x0101, &info) == SOCKET_ERROR)
{
- // throw error? perhaps give it its own id in the furture
+ // throw error? perhaps give it its own id in the future
THROW_EXCEPTION(BackupStoreException, Internal)
}
#endif
@@ -90,7 +91,13 @@
FILE *logFile = 0;
// Filename for configuration file?
- const char *configFilename = BOX_FILE_BBACKUPD_DEFAULT_CONFIG;
+ std::string configFilename;
+
+ #ifdef WIN32
+ configFilename = BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE;
+ #else
+ configFilename = BOX_FILE_BBACKUPD_DEFAULT_CONFIG;
+ #endif
// Flags
bool quiet = false;
@@ -215,9 +222,14 @@
#endif // WIN32
// Read in the configuration file
- if(!quiet) printf("Using configuration file %s\n", configFilename);
+ if(!quiet) printf("Using configuration file %s\n",
+ configFilename.c_str());
+
std::string errs;
- std::auto_ptr<Configuration> config(Configuration::LoadAndVerify(configFilename, &BackupDaemonConfigVerify, errs));
+ std::auto_ptr<Configuration> config(
+ Configuration::LoadAndVerify
+ (configFilename, &BackupDaemonConfigVerify, errs));
+
if(config.get() == 0 || !errs.empty())
{
printf("Invalid configuration file:\n%s", errs.c_str());
Modified: box/chris/general/bin/bbstoreaccounts/bbstoreaccounts.cpp
===================================================================
--- box/chris/general/bin/bbstoreaccounts/bbstoreaccounts.cpp 2007-05-26 15:30:37 UTC (rev 1689)
+++ box/chris/general/bin/bbstoreaccounts/bbstoreaccounts.cpp 2007-05-26 15:33:26 UTC (rev 1690)
@@ -402,12 +402,19 @@
int main(int argc, const char *argv[])
{
- MAINHELPER_SETUP_MEMORY_LEAK_EXIT_REPORT("bbstoreaccounts.memleaks", "bbstoreaccounts")
+ MAINHELPER_SETUP_MEMORY_LEAK_EXIT_REPORT("bbstoreaccounts.memleaks",
+ "bbstoreaccounts")
MAINHELPER_START
- // Filename for configuraiton file?
- const char *configFilename = BOX_FILE_BBSTORED_DEFAULT_CONFIG;
+ // Filename for configuration file?
+ std::string configFilename;
+
+ #ifdef WIN32
+ configFilename = BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE;
+ #else
+ configFilename = BOX_FILE_BBSTORED_DEFAULT_CONFIG;
+ #endif
// See if there's another entry on the command line
int c;
@@ -431,7 +438,10 @@
// Read in the configuration file
std::string errs;
- std::auto_ptr<Configuration> config(Configuration::LoadAndVerify(configFilename, &BackupConfigFileVerify, errs));
+ std::auto_ptr<Configuration> config(
+ Configuration::LoadAndVerify
+ (configFilename, &BackupConfigFileVerify, errs));
+
if(config.get() == 0 || !errs.empty())
{
printf("Invalid configuration file:\n%s", errs.c_str());
Modified: box/chris/general/bin/bbstored/bbstored.cpp
===================================================================
--- box/chris/general/bin/bbstored/bbstored.cpp 2007-05-26 15:30:37 UTC (rev 1689)
+++ box/chris/general/bin/bbstored/bbstored.cpp 2007-05-26 15:33:26 UTC (rev 1690)
@@ -23,7 +23,14 @@
Logging::ToSyslog (true);
BackupStoreDaemon daemon;
- return daemon.Main(BOX_FILE_BBSTORED_DEFAULT_CONFIG, argc, argv);
+
+ #ifdef WIN32
+ return daemon.Main(BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE,
+ argc, argv);
+ #else
+ return daemon.Main(BOX_FILE_BBSTORED_DEFAULT_CONFIG,
+ argc, argv);
+ #endif
MAINHELPER_END
}