- msgindex = cmd_hash(msg->cmd);
-
- for (ptr = msg_hash_table[msgindex]; ptr; ptr = ptr->next)
- {
- if(strcasecmp(msg->cmd, ptr->cmd) == 0)
- {
- MyFree(ptr->cmd);
- if(last_ptr != NULL)
- last_ptr->next = ptr->next;
- else
- msg_hash_table[msgindex] = ptr->next;
- MyFree(ptr);
- return;
- }
- last_ptr = ptr;
- }
-}
-
-/* hash_parse
- *
- * inputs - command name
- * output - pointer to struct Message
- * side effects -
- */
-static struct Message *
-hash_parse(const char *cmd)
-{
- struct MessageHash *ptr;
- int msgindex;
-
- msgindex = cmd_hash(cmd);
-
- for (ptr = msg_hash_table[msgindex]; ptr; ptr = ptr->next)
- {
- if(strcasecmp(cmd, ptr->cmd) == 0)
- return (ptr->msg);
- }
-
- return NULL;
-}
-
-/* alias_parse
- *
- * inputs - command name
- * output - pointer to struct Message
- * side effects -
- */
-static struct alias_entry *
-alias_parse(const char *cmd)
-{
- dlink_node *ptr;
- int msgindex;
-
- msgindex = cmd_hash(cmd);
-
- DLINK_FOREACH(ptr, alias_hash_table[msgindex].head)
- {
- struct alias_entry *ent = (struct alias_entry *) ptr->data;
-
- if(strcasecmp(cmd, ent->name) == 0)
- return ent;
- }
-
- return NULL;
-}
-
-/*
- * hash
- *
- * inputs - char string
- * output - hash index
- * side effects - NONE
- *
- * BUGS - This a HORRIBLE hash function
- */
-static int
-cmd_hash(const char *p)
-{
- int hash_val = 0;
-
- while (*p)
- {
- hash_val += ((int) (*p) & 0xDF);
- p++;
- }
-
- return (hash_val % MAX_MSG_HASH);