]>
jfr.im git - irc/quakenet/newserv.git/blob - helpmod/helpmod_alias.c
1 #include "helpmod_alias.h"
3 int helpmod_alias_count(alias_tree node
)
8 return 1 + helpmod_alias_count(node
->left
) + helpmod_alias_count(node
->right
);
11 void helpmod_init_alias(alias_tree
* node
)
13 *node
= (alias_tree
)malloc(sizeof(struct alias_tree_struct
));
15 (*node
)->right
= NULL
;
17 (*node
)->state
= NULL
;
19 void helpmod_clear_aliases(alias_tree
* node
)
23 helpmod_clear_aliases(&(*node
)->left
);
24 helpmod_clear_aliases(&(*node
)->right
);
25 freesstring((*node
)->name
);
29 helpmod_entry
helpmod_get_alias(char* search
)
32 alias_tree tmp
= aliases
;
35 val
= strcmp(tmp
->name
->content
, search
);
46 void helpmod_add_alias(char* name
, helpmod_entry state
)
49 alias_tree
* tmp
= &aliases
;
52 val
= strcmp((*tmp
)->name
->content
, name
);
54 return; /* duplicate, let's not do anything, silly person to create duplicates in the file.. */
60 helpmod_init_alias(tmp
);
61 (*tmp
)->state
= state
;
62 (*tmp
)->name
= getsstring(name
,strlen(name
));
63 for (val
=0;val
< strlen(name
);val
++)
64 if (isspace((*tmp
)->name
->content
[val
]))
66 (*tmp
)->name
->content
[val
] = 0x00;