From: Andre Noll <maan@tuebingen.mpg.de>
Date: Sat, 4 Apr 2015 20:22:53 +0000 (+0000)
Subject: Unify version command handlers.
X-Git-Tag: v0.5.6~94^2~37
X-Git-Url: https://git.tue.mpg.de/?a=commitdiff_plain;h=26dc18b2c1faa0d284b579d6ed3ccf1d479e65d3;p=paraslash.git

Unify version command handlers.

para_audiod's version command supports the -v flag, but the one of
para_server does not and always prints the full version text. This
adds the -v flag to the server command and makes it behave identical
to its counterpart.
---

diff --git a/command.c b/command.c
index eac09f05..22948dbb 100644
--- a/command.c
+++ b/command.c
@@ -425,9 +425,10 @@ static int com_version(struct command_context *cc)
 	char *msg;
 	size_t len;
 
-	if (cc->argc != 1)
-		return -E_COMMAND_SYNTAX;
-	len = xasprintf(&msg, "%s", version_text("server"));
+	if (cc->argc > 1 && strcmp(cc->argv[1], "-v") == 0)
+		len = xasprintf(&msg, "%s", version_text("server"));
+	else
+		len = xasprintf(&msg, "%s\n", version_single_line("server"));
 	return send_sb(&cc->scc, msg, len, SBD_OUTPUT, false);
 }