summaryrefslogtreecommitdiff
path: root/src/commands.c
diff options
context:
space:
mode:
authorAdam <Adam@drink-coca-cola.info>2010-04-24 17:18:25 -0400
committerAdam <Adam@anope.org>2010-06-18 20:55:38 -0400
commitfa82890696c498f38643df7df6891434c91c9269 (patch)
tree4b28359e75c29825586e6b2394e5334e43ea074b /src/commands.c
parent2ba89de64d3b755f731f202dd97c48d256db8031 (diff)
Moved Commands stuff to its own file and changed Command::name to be ci::string - Will be used after hashing system is rewritten
Diffstat (limited to 'src/commands.c')
-rw-r--r--src/commands.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/commands.c b/src/commands.c
index 19d668137..40363a7d1 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -12,13 +12,37 @@
*/
#include "services.h"
-#include "commands.h"
+#include "modules.h"
#include "language.h"
#include "hashcomp.h"
/*************************************************************************/
/**
+ * Search the command table gieven for a command.
+ * @param cmdTable the name of the command table to search
+ * @param name the name of the command to look for
+ * @return returns a pointer to the found command struct, or NULL
+ */
+Command *findCommand(CommandHash * cmdTable[], const char *name)
+{
+ int idx;
+ CommandHash *current = NULL;
+ if (!cmdTable || !name) {
+ return NULL;
+ }
+
+ idx = CMD_HASH(name);
+
+ for (current = cmdTable[idx]; current; current = current->next) {
+ if (stricmp(name, current->name) == 0) {
+ return current->c;
+ }
+ }
+ return NULL;
+}
+
+/**
* Return the Command corresponding to the given name, or NULL if no such
* command exists.
* @param list Command struct