summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/bbackupctl/bbackupctl.cpp17
-rw-r--r--bin/bbackupd/Win32BackupService.cpp26
-rw-r--r--bin/bbackupd/bbackupd.cpp2
-rw-r--r--bin/bbackupquery/bbackupquery.cpp22
-rw-r--r--bin/bbstoreaccounts/bbstoreaccounts.cpp18
-rw-r--r--bin/bbstored/BackupStoreDaemon.cpp18
-rw-r--r--bin/bbstored/bbstored.cpp9
7 files changed, 80 insertions, 32 deletions
diff --git a/bin/bbackupctl/bbackupctl.cpp b/bin/bbackupctl/bbackupctl.cpp
index 9fb8f259..f0a966c4 100644
--- a/bin/bbackupctl/bbackupctl.cpp
+++ b/bin/bbackupctl/bbackupctl.cpp
@@ -66,7 +66,13 @@ int main(int argc, const char *argv[])
#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 @@ int main(int argc, const char *argv[])
}
// 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());
diff --git a/bin/bbackupd/Win32BackupService.cpp b/bin/bbackupd/Win32BackupService.cpp
index 7cbf4828..1470b42d 100644
--- a/bin/bbackupd/Win32BackupService.cpp
+++ b/bin/bbackupd/Win32BackupService.cpp
@@ -29,31 +29,23 @@ void TerminateService(void)
DWORD Win32BackupService::WinService(const char* pConfigFileName)
{
- char exepath[MAX_PATH];
- GetModuleFileName(NULL, exepath, sizeof(exepath));
+ DWORD ret;
+
+ // keep MAINHELPER_START happy
+ int argc = 0;
+ char* argv[] = {NULL};
+
+ MAINHELPER_START
- std::string configfile;
-
if (pConfigFileName != NULL)
{
- configfile = pConfigFileName;
+ ret = this->Main(pConfigFileName);
}
else
{
- // make the default config file name,
- // based on the program path
- configfile = exepath;
- configfile = configfile.substr(0,
- configfile.rfind(DIRECTORY_SEPARATOR_ASCHAR));
- configfile += DIRECTORY_SEPARATOR "bbackupd.conf";
+ ret = this->Main(BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE);
}
- const char *argv[] = {exepath, "-c", configfile.c_str()};
- int argc = sizeof(argv) / sizeof(*argv);
- DWORD ret;
-
- MAINHELPER_START
- ret = this->Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv);
MAINHELPER_END
return ret;
diff --git a/bin/bbackupd/bbackupd.cpp b/bin/bbackupd/bbackupd.cpp
index f7091140..b8c8f61a 100644
--- a/bin/bbackupd/bbackupd.cpp
+++ b/bin/bbackupd/bbackupd.cpp
@@ -89,7 +89,7 @@ int main(int argc, const char *argv[])
else
{
ExitCode = gpDaemonService->Main(
- BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv);
+ BOX_GET_DEFAULT_BBACKUPD_CONFIG_FILE, argc, argv);
}
delete gpDaemonService;
diff --git a/bin/bbackupquery/bbackupquery.cpp b/bin/bbackupquery/bbackupquery.cpp
index d02c3922..9cc3eb1a 100644
--- a/bin/bbackupquery/bbackupquery.cpp
+++ b/bin/bbackupquery/bbackupquery.cpp
@@ -66,7 +66,8 @@ int main(int argc, const char *argv[])
{
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 @@ int main(int argc, const char *argv[])
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 @@ int main(int argc, const char *argv[])
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 @@ int main(int argc, const char *argv[])
#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());
diff --git a/bin/bbstoreaccounts/bbstoreaccounts.cpp b/bin/bbstoreaccounts/bbstoreaccounts.cpp
index dd42458b..567c5bbc 100644
--- a/bin/bbstoreaccounts/bbstoreaccounts.cpp
+++ b/bin/bbstoreaccounts/bbstoreaccounts.cpp
@@ -402,12 +402,19 @@ void PrintUsageAndExit()
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 @@ int main(int argc, const char *argv[])
// 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());
diff --git a/bin/bbstored/BackupStoreDaemon.cpp b/bin/bbstored/BackupStoreDaemon.cpp
index c9601575..049c0ae4 100644
--- a/bin/bbstored/BackupStoreDaemon.cpp
+++ b/bin/bbstored/BackupStoreDaemon.cpp
@@ -132,7 +132,23 @@ void BackupStoreDaemon::SetupInInitialProcess()
// Initialise the raid files controller
RaidFileController &rcontroller = RaidFileController::GetController();
- rcontroller.Initialise(config.GetKeyValue("RaidFileConf").c_str());
+
+ std::string raidFileConfig;
+
+ #ifdef WIN32
+ if (!config.KeyExists("RaidFileConf"))
+ {
+ raidFileConfig = BOX_GET_DEFAULT_RAIDFILE_CONFIG_FILE;
+ }
+ else
+ {
+ raidFileConfig = config.GetKeyValue("RaidFileConf");
+ }
+ #else
+ raidFileConfig = config.GetKeyValue("RaidFileConf");
+ #endif
+
+ rcontroller.Initialise(raidFileConfig);
// Load the account database
std::auto_ptr<BackupStoreAccountDatabase> pdb(BackupStoreAccountDatabase::Read(config.GetKeyValue("AccountDatabase").c_str()));
diff --git a/bin/bbstored/bbstored.cpp b/bin/bbstored/bbstored.cpp
index c0ea1199..54858dd4 100644
--- a/bin/bbstored/bbstored.cpp
+++ b/bin/bbstored/bbstored.cpp
@@ -23,7 +23,14 @@ int main(int argc, const char *argv[])
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
}