added command line parsing, restartability, and daemonizing to

client.  broke win32 stuff though.  also moved version and
copyright constants into a new file and renamed protocol
version constants.
This commit is contained in:
crs
2002-06-04 11:06:26 +00:00
parent e409c83ef9
commit c3649df304
7 changed files with 371 additions and 41 deletions

View File

@@ -1059,7 +1059,8 @@ void CServer::handshakeClient(void* vsocket)
// say hello
log((CLOG_DEBUG1 "saying hello"));
CProtocolUtil::writef(output.get(), "Synergy%2i%2i",
kMajorVersion, kMinorVersion);
kProtocolMajorVersion,
kProtocolMinorVersion);
output->flush();
// wait for the reply
@@ -1117,7 +1118,7 @@ void CServer::handshakeClient(void* vsocket)
// FIXME -- could print network address if socket had suitable method
log((CLOG_WARN "client \"%s\" has incompatible version %d.%d)", name.c_str(), e.getMajor(), e.getMinor()));
CProtocolUtil::writef(output.get(), kMsgEIncompatible,
kMajorVersion, kMinorVersion);
kProtocolMajorVersion, kProtocolMinorVersion);
}
catch (XBadClient&) {
// client not behaving

View File

@@ -56,13 +56,13 @@ IServerProtocol* CServerProtocol::create(SInt32 major, SInt32 minor,
}
// disallow connection from test versions to release versions
if (major == 0 && kMajorVersion != 0) {
if (major == 0 && kProtocolMajorVersion != 0) {
throw XIncompatibleClient(major, minor);
}
// hangup (with error) if version isn't supported
if (major > kMajorVersion ||
(major == kMajorVersion && minor > kMinorVersion)) {
if (major > kProtocolMajorVersion ||
(major == kProtocolMajorVersion && minor > kProtocolMinorVersion)) {
throw XIncompatibleClient(major, minor);
}

View File

@@ -6,14 +6,10 @@
#include "CThread.h"
#include "XThread.h"
#include "ProtocolTypes.h"
#include "Version.h"
#include "stdfstream.h"
#include <assert.h>
static const char* s_copyright = "Copyright (C) 2002 Chris Schoeneman";
static const SInt32 s_majorVersion = 0;
static const SInt32 s_minorVersion = 5;
static const char s_releaseVersion = ' ';
// configuration file name
#if defined(CONFIG_PLATFORM_WIN32)
#define CONFIG_NAME "synergy.sgc"
@@ -115,15 +111,15 @@ static void bye()
static void version()
{
log((CLOG_PRINT
"%s %d.%d%c protocol version %d.%d\n"
"%s %d.%d.%d, protocol version %d.%d\n"
"%s",
pname,
s_majorVersion,
s_minorVersion,
s_releaseVersion,
kMajorVersion,
kMinorVersion,
s_copyright));
kReleaseVersion,
kProtocolMajorVersion,
kProtocolMinorVersion,
kCopyright));
}
static void help()
@@ -335,6 +331,7 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
// load the configuration file if we haven't already
if (s_configFile == NULL) {
// FIXME
}
// FIXME
@@ -531,7 +528,6 @@ int main(int argc, char** argv)
}
catch (XBase& e) {
log((CLOG_CRIT "failed: %s", e.what()));
fprintf(stderr, "failed: %s\n", e.what());
return 16;
}
catch (XThread&) {