From 7dd9d4300cf5dd44a1141e12f885413cb5616a53 Mon Sep 17 00:00:00 2001 From: KLuka Date: Thu, 3 Sep 2015 18:58:51 +0200 Subject: [PATCH] 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. --- shellinabox/shellinaboxd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/shellinabox/shellinaboxd.c b/shellinabox/shellinaboxd.c index 1ba2a3b..cabe922 100644 --- a/shellinabox/shellinaboxd.c +++ b/shellinabox/shellinaboxd.c @@ -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,18 +1212,19 @@ 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]); + buf = stringPrintf(buf, "%s ", argv[i]); } info("[server] Command line: %s", buf); free(buf);