Minor improvements

* Use stdout for usage and version information. Patch taken from
  issue #344.
* Removed automatic usage display when command line parsing fails.
* Added version information in debug output.
This commit is contained in:
KLuka 2015-09-03 18:58:51 +02:00
parent b58542eb99
commit 7dd9d4300c

View file

@ -768,7 +768,7 @@ static void usage(void) {
const char *user = getUserName(r_uid);
const char *group = getGroupName(r_gid);
message("Usage: shellinaboxd [OPTIONS]...\n"
printf("Usage: shellinaboxd [OPTIONS]...\n"
"Starts an HTTP server that serves terminal emulators to AJAX "
"enabled browsers.\n"
"\n"
@ -835,7 +835,8 @@ static void usage(void) {
"\n"
"OPTIONs that make up a GROUP are mutually exclusive. But "
"individual GROUPs are\n"
"independent of each other.\n",
"independent of each other.\n"
"\n",
!serverSupportsSSL() ? "" :
" -c, --cert=CERTDIR set certificate dir "
"(default: $PWD)\n"
@ -1211,16 +1212,17 @@ static void parseArgs(int argc, char * const argv[]) {
logSetLogLevel(verbosity);
} else if (!idx--) {
// Version
message("ShellInABox version " VERSION VCS_REVISION);
printf("ShellInABox version " VERSION VCS_REVISION "\n");
exit(0);
}
}
if (optind != argc) {
usage();
fatal("[config] Failed to parse command line!");
}
char *buf = NULL;
check(argc >= 1);
info("[server] Version " VERSION VCS_REVISION);
for (int i = 0; i < argc; i++) {
buf = stringPrintf(buf, "%s ", argv[i]);
}