From aa7be1dc4bb26266b1ff520b89fd7781be71e59b Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Tue, 30 Jun 2009 11:48:58 +0200 Subject: [PATCH] Fix a command parse error output problem, plus some minor cleaning up. --- src/commands.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands.c b/src/commands.c index e362330..b4a08bd 100644 --- a/src/commands.c +++ b/src/commands.c @@ -23,6 +23,8 @@ #define CRASH_DEBUG #endif +#define MAX_HELP_MSG 1024 + struct hub_command { const char* message; @@ -133,6 +135,7 @@ const char* command_get_syntax(struct commands_handler* handler) { for (n = 0; n < strlen(handler->args); n++) { + if (n > 0) strcat(args, " "); switch (handler->args[n]) { case 'n': strcat(args, ""); break; @@ -177,12 +180,11 @@ static int command_stats(struct hub_info* hub, struct user* user, struct hub_com static int command_help(struct hub_info* hub, struct user* user, struct hub_command* cmd) { -#define MAX_HELP_MSG 1024 size_t n; char msg[MAX_HELP_MSG]; msg[0] = 0; strcat(msg, "Available commands:\n"); - + for (n = 0; command_handlers[n].prefix; n++) { if (command_handlers[n].cred <= user->credentials)