[Box Backup-dev] COMMIT r208 - box/chris/win32/crash-test-pipes/bin/bbackupd

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Mon, 12 Dec 2005 01:21:27 +0000 (GMT)


Author: chris
Date: 2005-12-12 01:21:17 +0000 (Mon, 12 Dec 2005)
New Revision: 208

Modified:
   box/chris/win32/crash-test-pipes/bin/bbackupd/BackupDaemon.cpp
   box/chris/win32/crash-test-pipes/bin/bbackupd/bbackupd.cpp
Log:
Made stand-alone, still crashes

Modified: box/chris/win32/crash-test-pipes/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/win32/crash-test-pipes/bin/bbackupd/BackupDaemon.cpp	2005-12-12 01:13:47 UTC (rev 207)
+++ box/chris/win32/crash-test-pipes/bin/bbackupd/BackupDaemon.cpp	2005-12-12 01:21:17 UTC (rev 208)
@@ -226,3 +226,28 @@
 		throw 2;
 	}
 }
+
+int main(int argc, const char *argv[])
+{
+	// Under win32 we must initialise the Winsock library
+	// before using sockets
+		
+	WSADATA info;
+
+	if (WSAStartup(MAKELONG(1, 1), &info) == SOCKET_ERROR) 
+	{
+		// box backup will not run without sockets
+		printf("Failed to initialise Windows Sockets\n");
+		exit(1);
+	}
+
+	// EnableBackupRights();
+
+	BackupDaemon Daemon;
+	Daemon.Run();
+
+	// Clean up our sockets
+	WSACleanup();
+
+	return 0;
+}

Modified: box/chris/win32/crash-test-pipes/bin/bbackupd/bbackupd.cpp
===================================================================
--- box/chris/win32/crash-test-pipes/bin/bbackupd/bbackupd.cpp	2005-12-12 01:13:47 UTC (rev 207)
+++ box/chris/win32/crash-test-pipes/bin/bbackupd/bbackupd.cpp	2005-12-12 01:21:17 UTC (rev 208)
@@ -1,81 +0,0 @@
-// --------------------------------------------------------------------------
-//
-// File
-//		Name:    bbackupd.cpp
-//		Purpose: main file for backup daemon
-//		Created: 2003/10/11
-//
-// --------------------------------------------------------------------------
-
-#include "Box.h"
-#include "BackupDaemon.h"
-#include "MainHelper.h"
-#include "BoxPortsAndFiles.h"
-#include "BackupStoreException.h"
-
-#include "MemLeakFindOn.h"
-
-#ifdef WIN32
-	#include "Win32ServiceFunctions.h"
-	#include "Win32BackupService.h"
-
-	extern Win32BackupService gDaemonService;
-#endif
-
-int main(int argc, const char *argv[])
-{
-	MAINHELPER_START
-
-	::openlog("Box Backup (bbackupd)", 0, 0);
-
-	if(argc == 2 &&
-		(::strcmp(argv[1], "--help") == 0 ||
-		 ::strcmp(argv[1], "-h") == 0))
-	{
-		printf("-h help, -i install service, -r remove service,\n"
-			"-c <config file> start daemon now");
-		return 2;
-	}
-	if(argc == 2 && ::strcmp(argv[1], "-r") == 0)
-	{
-		RemoveService();
-		return 0;
-	}
-	if(argc == 2 && ::strcmp(argv[1], "-i") == 0)
-	{
-		InstallService();
-		return 0;
-	}
-		
-	// Under win32 we must initialise the Winsock library
-	// before using sockets
-		
-	WSADATA info;
-
-	if (WSAStartup(MAKELONG(1, 1), &info) == SOCKET_ERROR) 
-	{
-		// box backup will not run without sockets
-		::syslog(LOG_ERR, "Failed to initialise Windows Sockets");
-		THROW_EXCEPTION(BackupStoreException, Internal)
-	}
-
-	EnableBackupRights();
-
-	if (argc == 2 && ::strcmp(argv[1], "--service") == 0)
-	{
-		syslog(LOG_INFO,"Starting Box Backup Service");
-		OurService();
-	}
-	else
-	{
-		gDaemonService.Run();
-	}
-
-	// Clean up our sockets
-	WSACleanup();
-	::closelog();
-
-	return 0;
-
-	MAINHELPER_END
-}