diff options
Diffstat (limited to 'misc.c')
| -rw-r--r-- | misc.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -52,4 +52,32 @@ char *mystrdup(char *s) return x; } return s; +} + +void strlist_add(struct strlist **list, char *str) +{ + struct strlist *item = malloc(sizeof(struct strlist)); + item->str = mystrdup(str); + item->next = *list; + *list = item; +} + +int strlist_find(struct strlist **list, char *str) +{ + struct strlist *item; + for(item=*list; item; item=item->next) + if(!strcmp(item->str, str)) + return 1; + return 0; +} + +void strlist_free(struct strlist **list) +{ + struct strlist *item; + while(*list) + { + item = *list; + *list = (*list)->next; + free(item); + } }
\ No newline at end of file |
