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
#define DAEMON_RUNNING(running_)
#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()
{
#if WINAPI_XWINDOWS
# define USAGE_DISPLAY_ARG \
# define WINAPI_ARG \
" [--display <display>]"
# define USAGE_DISPLAY_INFO \
# define WINAPI_INFO \
" --display <display> connect to the X server at <display>\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 <level>]"
USAGE_DISPLAY_ARG
" [--name <screen-name>]"
" [--yscroll <delta>]"
" [--restart|--no-restart]"
WINAPI_ARG
HELP_COMMON_ARGS
" <server-address>"
"\n\n"
"Start the synergy mouse/keyboard sharing server.\n"
"Connect to a synergy mouse/keyboard sharing server.\n"
"\n"
" -d, --debug <level> 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 <screen-name> use screen-name instead the hostname to identify\n"
" ourself to the server.\n"
HELP_COMMON_INFO_1
WINAPI_INFO
" --yscroll <delta> 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 <file> 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
);

View File

@ -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 <display>]"
# define USAGE_DISPLAY_INFO \
# define WINAPI_INFO \
" --display <display> connect to the X server at <display>\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 <address>]"
" [--config <pathname>]"
" [--debug <level>]"
USAGE_DISPLAY_ARG
" [--name <screen-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 <address> listen for clients on the given address.\n"
" -c, --config <pathname> use the named configuration file instead.\n"
" -d, --debug <level> 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 <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"
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: [<hostname>][:<port>]. 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;
}