diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-05-01 14:12:16 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-05-01 14:12:16 +0200 |
commit | aa44835c3f8330b4ce2f3b120d601c687a6f3115 (patch) | |
tree | 55100cd963b0f99c26ea2d39e95593a6563df1c3 /FICS/command.c | |
parent | 17ab1c55b0a1dc8f3e951cc8d8967673e659467a (diff) |
Reformatted match_command()
Diffstat (limited to 'FICS/command.c')
-rw-r--r-- | FICS/command.c | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/FICS/command.c b/FICS/command.c index e0d65da..a8a0390 100644 --- a/FICS/command.c +++ b/FICS/command.c @@ -181,31 +181,39 @@ PRIVATE void alias_substitute(alias_type *alias_list, int num_alias, } } -/* Returns pointer to command that matches */ -PRIVATE int match_command(char *comm, int p) +/* + * Returns pointer to command that matches + */ +PRIVATE int +match_command(char *comm, int p) { - int i = 0; - int gotIt = -1; - int len = strlen(comm); - - while (command_list[i].comm_name) { - if (!strncmp(command_list[i].comm_name, comm, len) - && parray[p].adminLevel >= command_list[i].adminLevel) { - if (gotIt >= 0) - return -COM_AMBIGUOUS; - gotIt = i; - } - i++; - } - if (in_list(p, L_REMOVEDCOM, command_list[gotIt].comm_name)) { - pprintf(p, "Due to a bug - this command has been temporarily removed.\n"); - return -COM_FAILED; - } - if (gotIt >= 0) { - lastCommandFound = gotIt; - return gotIt; - } - return -COM_FAILED; + int gotIt = -1; + int i = 0; + int len = strlen(comm); + + while (command_list[i].comm_name) { + if (!strncmp(command_list[i].comm_name, comm, len) && + parray[p].adminLevel >= command_list[i].adminLevel) { + if (gotIt >= 0) + return -COM_AMBIGUOUS; + gotIt = i; + } + + i++; + } + + if (in_list(p, L_REMOVEDCOM, command_list[gotIt].comm_name)) { + pprintf(p, "Due to a bug - this command has been temporarily " + "removed.\n"); + return -COM_FAILED; + } + + if (gotIt >= 0) { + lastCommandFound = gotIt; + return gotIt; + } + + return -COM_FAILED; } /* |