Fixed issue 498 -- merged the --help args together a little bit from each server and client

This commit is contained in:
Nick Bolton 2010-06-04 23:33:30 +00:00
parent f3e4c6dede
commit 15cee8a74d
3 changed files with 65 additions and 77 deletions

View File

@ -103,3 +103,43 @@ private:
#else #else
#define DAEMON_RUNNING(running_) #define DAEMON_RUNNING(running_)
#endif #endif
#define HELP_COMMON_INFO_1 \
" -d, --debug <level> 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 <screen-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 <file> 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 <screen-name>]" \
" [--restart|--no-restart]" \
" [--debug <level>]"
// 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 <action>]"
# define HELP_SYS_INFO \
" --service <action> manage the windows service, valid options are:\n" \
" install/uninstall/start/stop\n"
#endif

View File

@ -164,45 +164,30 @@ void
CClientApp::help() CClientApp::help()
{ {
#if WINAPI_XWINDOWS #if WINAPI_XWINDOWS
# define USAGE_DISPLAY_ARG \ # define WINAPI_ARG \
" [--display <display>]" " [--display <display>]"
# define USAGE_DISPLAY_INFO \ # define WINAPI_INFO \
" --display <display> connect to the X server at <display>\n" " --display <display> connect to the X server at <display>\n"
#else #else
# define USAGE_DISPLAY_ARG # define WINAPI_ARG
# define USAGE_DISPLAY_INFO # define WINAPI_INFO
#endif #endif
char buffer[2000]; char buffer[2000];
sprintf( sprintf(
buffer, buffer,
"Usage: %s" "Usage: %s"
" [--daemon|--no-daemon]"
" [--debug <level>]"
USAGE_DISPLAY_ARG
" [--name <screen-name>]"
" [--yscroll <delta>]" " [--yscroll <delta>]"
" [--restart|--no-restart]" WINAPI_ARG
HELP_COMMON_ARGS
" <server-address>" " <server-address>"
"\n\n" "\n\n"
"Start the synergy mouse/keyboard sharing server.\n" "Connect to a synergy mouse/keyboard sharing server.\n"
"\n" "\n"
" -d, --debug <level> filter out log messages with priorty below level.\n" HELP_COMMON_INFO_1
" level may be: FATAL, ERROR, WARNING, NOTE, INFO,\n" WINAPI_INFO
" 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 <screen-name> use screen-name instead the hostname to identify\n"
" ourself to the server.\n"
" --yscroll <delta> defines the vertical scrolling delta, which is\n" " --yscroll <delta> defines the vertical scrolling delta, which is\n"
" 120 by default.\n" HELP_COMMON_INFO_2
" -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 <file> write log messages to file.\n"
" -h, --help display this help and exit.\n"
" --version display version information and exit.\n"
"\n" "\n"
"* marks defaults.\n" "* marks defaults.\n"
"\n" "\n"

View File

@ -155,33 +155,15 @@ CServerApp::parseArgs(int argc, const char* const* argv)
void void
CServerApp::help() CServerApp::help()
{ {
// window api args (windows/x-windows/carbon)
#if WINAPI_XWINDOWS #if WINAPI_XWINDOWS
# define USAGE_DISPLAY_ARG \ # define WINAPI_ARGS \
" [--display <display>]" " [--display <display>]"
# define USAGE_DISPLAY_INFO \ # define WINAPI_INFO \
" --display <display> connect to the X server at <display>\n" " --display <display> connect to the X server at <display>\n"
#else #else
# define USAGE_DISPLAY_ARG # define WINAPI_ARGS
# define USAGE_DISPLAY_INFO # define WINAPI_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
#endif #endif
char buffer[2000]; char buffer[2000];
@ -190,35 +172,21 @@ CServerApp::help()
"Usage: %s" "Usage: %s"
" [--address <address>]" " [--address <address>]"
" [--config <pathname>]" " [--config <pathname>]"
" [--debug <level>]" WINAPI_ARGS
USAGE_DISPLAY_ARG HELP_SYS_ARGS
" [--name <screen-name>]" HELP_COMMON_ARGS
" [--restart|--no-restart]"
PLATFORM_ARGS
"\n\n" "\n\n"
"Start the synergy mouse/keyboard sharing server.\n" "Start the synergy mouse/keyboard sharing server.\n"
"\n" "\n"
" -a, --address <address> listen for clients on the given address.\n" " -a, --address <address> listen for clients on the given address.\n"
" -c, --config <pathname> use the named configuration file instead.\n" " -c, --config <pathname> use the named configuration file instead.\n"
" -d, --debug <level> filter out log messages with priorty below level.\n" HELP_COMMON_INFO_1
" level may be: FATAL, ERROR, WARNING, NOTE, INFO,\n" WINAPI_INFO
" DEBUG, DEBUG1, DEBUG2.\n" HELP_SYS_INFO
USAGE_DISPLAY_INFO HELP_COMMON_INFO_2
" -f, --no-daemon run the server in the foreground.\n"
"* --daemon run the server as a daemon.\n"
" -n, --name <screen-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 <file> write log messages to file.\n"
PLATFORM_DESC
" -h, --help display this help and exit.\n"
" --version display version information and exit.\n"
"\n" "\n"
"* marks defaults.\n" "* marks defaults.\n"
"\n" "\n"
PLATFORM_EXTRA
"The argument for --address is of the form: [<hostname>][:<port>]. The\n" "The argument for --address is of the form: [<hostname>][:<port>]. The\n"
"hostname must be the address or hostname of an interface on the system.\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" "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" "If no configuration file pathname is provided then the first of the\n"
"following to load successfully sets the configuration:\n" "following to load successfully sets the configuration:\n"
" %s\n" " %s\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.",
args().m_pname, kDefaultPort, args().m_pname, kDefaultPort,
ARCH->concatPath(ARCH->getUserDirectory(), USR_CONFIG_NAME).c_str(), ARCH->concatPath(ARCH->getUserDirectory(), USR_CONFIG_NAME).c_str(),
ARCH->concatPath(ARCH->getSystemDirectory(), SYS_CONFIG_NAME).c_str() ARCH->concatPath(ARCH->getSystemDirectory(), SYS_CONFIG_NAME).c_str()
); );
std::cout << buffer << std::endl; std::cout << buffer << std::endl;
} }