diff --git a/lib/synergy/CApp.h b/lib/synergy/CApp.h index c13d0ec3..31ff8b52 100644 --- a/lib/synergy/CApp.h +++ b/lib/synergy/CApp.h @@ -103,3 +103,43 @@ private: #else #define DAEMON_RUNNING(running_) #endif + +#define HELP_COMMON_INFO_1 \ + " -d, --debug filter out log messages with priorty below level.\n" \ + " level may be: FATAL, ERROR, WARNING, NOTE, INFO,\n" \ + " DEBUG, DEBUGn (1-5).\n" \ + " -n, --name use screen-name instead the hostname to identify\n" \ + " this screen in the configuration.\n" \ + " -1, --no-restart do not try to restart on failure.\n" \ + "* --restart restart the server automatically if it fails.\n" \ + " -l --log write log messages to file.\n" + +#define HELP_COMMON_INFO_2 \ + " -h, --help display this help and exit.\n" \ + " --version display version information and exit.\n" + +#define HELP_COMMON_ARGS \ + " [--name ]" \ + " [--restart|--no-restart]" \ + " [--debug ]" + +// system args (windows/unix) +#if SYSAPI_UNIX + +// unix daemon mode args +# define HELP_SYS_ARGS \ + " [--daemon|--no-daemon]" +# define HELP_SYS_INFO \ + " -f, --no-daemon run in the foreground.\n" \ + "* --daemon run as a daemon.\n" + +#elif SYSAPI_WIN32 + +// windows service management args +# define HELP_SYS_ARGS \ + " [--service ]" +# define HELP_SYS_INFO \ + " --service manage the windows service, valid options are:\n" \ + " install/uninstall/start/stop\n" + +#endif diff --git a/lib/synergy/CClientApp.cpp b/lib/synergy/CClientApp.cpp index 5d4edec8..7bfb0ec6 100644 --- a/lib/synergy/CClientApp.cpp +++ b/lib/synergy/CClientApp.cpp @@ -164,45 +164,30 @@ void CClientApp::help() { #if WINAPI_XWINDOWS -# define USAGE_DISPLAY_ARG \ +# define WINAPI_ARG \ " [--display ]" -# define USAGE_DISPLAY_INFO \ +# define WINAPI_INFO \ " --display connect to the X server at \n" #else -# define USAGE_DISPLAY_ARG -# define USAGE_DISPLAY_INFO +# define WINAPI_ARG +# define WINAPI_INFO #endif char buffer[2000]; sprintf( buffer, "Usage: %s" - " [--daemon|--no-daemon]" - " [--debug ]" - USAGE_DISPLAY_ARG - " [--name ]" " [--yscroll ]" - " [--restart|--no-restart]" + WINAPI_ARG + HELP_COMMON_ARGS " " "\n\n" - "Start the synergy mouse/keyboard sharing server.\n" + "Connect to a synergy mouse/keyboard sharing server.\n" "\n" - " -d, --debug filter out log messages with priorty below level.\n" - " level may be: FATAL, ERROR, WARNING, NOTE, INFO,\n" - " DEBUG, DEBUG1, DEBUG2.\n" - USAGE_DISPLAY_INFO - " -f, --no-daemon run the client in the foreground.\n" - "* --daemon run the client as a daemon.\n" - " -n, --name use screen-name instead the hostname to identify\n" - " ourself to the server.\n" + HELP_COMMON_INFO_1 + WINAPI_INFO " --yscroll defines the vertical scrolling delta, which is\n" - " 120 by default.\n" - " -1, --no-restart do not try to restart the client if it fails for\n" - " some reason.\n" - "* --restart restart the client automatically if it fails.\n" - " -l --log write log messages to file.\n" - " -h, --help display this help and exit.\n" - " --version display version information and exit.\n" + HELP_COMMON_INFO_2 "\n" "* marks defaults.\n" "\n" @@ -211,7 +196,7 @@ CClientApp::help() "default port, %d.\n" "\n" "Where log messages go depends on the platform and whether or not the\n" - "client is running as a daemon.", + "client is running as a daemon.", args().m_pname, kDefaultPort ); diff --git a/lib/synergy/CServerApp.cpp b/lib/synergy/CServerApp.cpp index 32c888d0..65610b14 100644 --- a/lib/synergy/CServerApp.cpp +++ b/lib/synergy/CServerApp.cpp @@ -155,33 +155,15 @@ CServerApp::parseArgs(int argc, const char* const* argv) void CServerApp::help() { + // window api args (windows/x-windows/carbon) #if WINAPI_XWINDOWS -# define USAGE_DISPLAY_ARG \ +# define WINAPI_ARGS \ " [--display ]" -# define USAGE_DISPLAY_INFO \ +# define WINAPI_INFO \ " --display connect to the X server at \n" #else -# define USAGE_DISPLAY_ARG -# define USAGE_DISPLAY_INFO -#endif - -#if SYSAPI_WIN32 - -# define PLATFORM_ARGS \ - " [--daemon|--no-daemon]" -# define PLATFORM_DESC -# define PLATFORM_EXTRA \ - "At least one command line argument is required. If you don't otherwise\n" \ - "need an argument use `--daemon'.\n" \ - "\n" - -#else - -# define PLATFORM_ARGS \ - " [--daemon|--no-daemon]" -# define PLATFORM_DESC -# define PLATFORM_EXTRA - +# define WINAPI_ARGS +# define WINAPI_INFO #endif char buffer[2000]; @@ -190,35 +172,21 @@ CServerApp::help() "Usage: %s" " [--address
]" " [--config ]" - " [--debug ]" - USAGE_DISPLAY_ARG - " [--name ]" - " [--restart|--no-restart]" - PLATFORM_ARGS + WINAPI_ARGS + HELP_SYS_ARGS + HELP_COMMON_ARGS "\n\n" "Start the synergy mouse/keyboard sharing server.\n" "\n" " -a, --address
listen for clients on the given address.\n" " -c, --config use the named configuration file instead.\n" - " -d, --debug filter out log messages with priorty below level.\n" - " level may be: FATAL, ERROR, WARNING, NOTE, INFO,\n" - " DEBUG, DEBUG1, DEBUG2.\n" - USAGE_DISPLAY_INFO - " -f, --no-daemon run the server in the foreground.\n" - "* --daemon run the server as a daemon.\n" - " -n, --name use screen-name instead the hostname to identify\n" - " this screen in the configuration.\n" - " -1, --no-restart do not try to restart the server if it fails for\n" - " some reason.\n" - "* --restart restart the server automatically if it fails.\n" - " -l --log write log messages to file.\n" - PLATFORM_DESC - " -h, --help display this help and exit.\n" - " --version display version information and exit.\n" + HELP_COMMON_INFO_1 + WINAPI_INFO + HELP_SYS_INFO + HELP_COMMON_INFO_2 "\n" "* marks defaults.\n" "\n" - PLATFORM_EXTRA "The argument for --address is of the form: [][:]. The\n" "hostname must be the address or hostname of an interface on the system.\n" "The default is to listen on all interfaces. The port overrides the\n" @@ -227,16 +195,11 @@ CServerApp::help() "If no configuration file pathname is provided then the first of the\n" "following to load successfully sets the configuration:\n" " %s\n" - " %s\n" - "If no configuration file can be loaded then the configuration uses its\n" - "defaults with just the server screen.\n" - "\n" - "Where log messages go depends on the platform and whether or not the\n" - "server is running as a daemon.", + " %s\n", args().m_pname, kDefaultPort, ARCH->concatPath(ARCH->getUserDirectory(), USR_CONFIG_NAME).c_str(), ARCH->concatPath(ARCH->getSystemDirectory(), SYS_CONFIG_NAME).c_str() - ); + ); std::cout << buffer << std::endl; }