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