X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=command.c;h=22948dbb3bc06034d384ad5447c780619840fa80;hp=5d6a0990597165bc5b17a7cfaf5595e73955ca09;hb=050003ccbd8b314038352f55d9fae53245670e78;hpb=16c6fc10f3344e3eec66e51580821d854d49aa62 diff --git a/command.c b/command.c index 5d6a0990..22948dbb 100644 --- a/command.c +++ b/command.c @@ -40,12 +40,16 @@ #include "signal.h" #include "version.h" +typedef int server_command_handler_t(struct command_context *); +static server_command_handler_t SERVER_COMMAND_HANDLERS; +server_command_handler_t AFS_COMMAND_HANDLERS; + /* Defines one command of para_server. */ struct server_command { /* The name of the command. */ const char *name; /* Pointer to the function that handles the command. */ - int (*handler)(struct command_context *); + server_command_handler_t *handler; /* The privileges a user must have to execute this command. */ unsigned int perms; /* One-line description of the command. */ @@ -421,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); }