diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-10-06 18:39:33 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-06 18:39:33 +0200 |
commit | d51da61b2d34a6c60caf6ce20022477dacade3f9 (patch) | |
tree | 98fa1d25eeb46a57de246ae17e6ac989b1000724 | |
parent | 836dcc28c5efaadab108ba20cad24829601a1ce1 (diff) |
command: fix return status
This got broken when listHandlerFunc was removed. Since we no
longer need it and it's confusing, remove processCommandInternal
and just use process_command.
-rw-r--r-- | src/command.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/command.c b/src/command.c index ae9d7ed1b..cf61fa183 100644 --- a/src/command.c +++ b/src/command.c @@ -1378,25 +1378,21 @@ static CommandEntry *getCommandEntryAndCheckArgcAndPermission(struct client *cli return cmd; } -static int processCommandInternal(struct client *client, - char *commandString, struct strnode *cmdnode) +int processCommand(struct client *client, char *commandString) { int argc; char *argv[COMMAND_ARGV_MAX] = { NULL }; CommandEntry *cmd; int ret = -1; - argc = buffer2array(commandString, argv, COMMAND_ARGV_MAX); - - if (argc == 0) + if (!(argc = buffer2array(commandString, argv, COMMAND_ARGV_MAX))) return 0; - if ((cmd = getCommandEntryAndCheckArgcAndPermission(client, - client_get_permission(client), - argc, argv))) { - if (!cmdnode) - ret = cmd->handler(client, argc, argv); - } + cmd = getCommandEntryAndCheckArgcAndPermission(client, + client_get_permission(client), + argc, argv); + if (cmd) + ret = cmd->handler(client, argc, argv); current_command = NULL; @@ -1414,7 +1410,7 @@ int processListOfCommands(struct client *client, while (cur) { DEBUG("processListOfCommands: process command \"%s\"\n", cur->data); - ret = processCommandInternal(client, cur->data, cur); + ret = processCommand(client, cur->data); DEBUG("processListOfCommands: command returned %i\n", ret); if (ret != 0 || client_is_expired(client)) goto out; @@ -1427,8 +1423,3 @@ out: command_listNum = 0; return ret; } - -int processCommand(struct client *client, char *commandString) -{ - return processCommandInternal(client, commandString, NULL); -} |