diff options
Diffstat (limited to 'wrapper/plugin-find.h')
-rw-r--r-- | wrapper/plugin-find.h | 70 |
1 files changed, 10 insertions, 60 deletions
diff --git a/wrapper/plugin-find.h b/wrapper/plugin-find.h index 1a5096b..0185117 100644 --- a/wrapper/plugin-find.h +++ b/wrapper/plugin-find.h @@ -37,78 +37,28 @@ struct plugin_command_list /*-----------------------------function-----------------------------*/ /* returns first plugin with `name' (duplicates are... unwise) */ +extern struct plugin * -plugin_find_plugin(struct plugin *node, char *name) -{ - - if (node==NULL) - return node; - else { - if (strcmp(node->name,name) == 0) - return node; - else - return plugin_find_plugin(node->next,name); - } -} +plugin_find_plugin(struct plugin *node, char *name); /* returns plugin `name within plugin `node' */ +extern struct plugin_command * -plugin_find_plugin_command(struct plugin_command *node, char *name) -{ - if (node==NULL) - return node; - else { - if (strcmp(node->name,name) == 0) - return node; - else - return plugin_find_plugin_command(node->next,name); - } -} +plugin_find_plugin_command(struct plugin_command *node, char *name); /* returns the first command with `name' it finds */ +extern struct plugin_command * -plugin_find_command(struct plugin *plugin, char *name) -{ - if (plugin==NULL) - return NULL; - else { - struct plugin_command *ret; - ret=plugin_find_plugin_command(plugin->commands,name); - if (ret == NULL) - ret=plugin_find_command(plugin->next,name); - return ret; - } -} +plugin_find_command(struct plugin *plugin, char *name); /* returns a linked list of all commands with `name' it finds */ +extern struct plugin_command_list * -plugin_find_commands(struct plugin *plugin, char *name) -{ - if (plugin==NULL) - return NULL; - else { - struct plugin_command *command; - command=plugin_find_command(plugin,name); - struct plugin_command_list *node; - if (command==NULL) - node=plugin_find_commands(plugin->next,name); - else { - node=xmalloc( sizeof *node ); - node->command=command; - node->next=plugin_find_commands(plugin->next,name); - } - return node; - } -} +plugin_find_commands(struct plugin *plugin, char *name); +extern void -plugin_free_list(struct plugin_command_list *node) -{ - if (node!=NULL) { - plugin_free_list(node->next); - xfree(node); - } -} +plugin_free_list(struct plugin_command_list *node); #endif |