output to stder, added list.* api which is still in work
[my-code/api.git] / list / list.c
1 /* list.c -- list management szuff
2  *
3  * author: hackbard@hackdaworld.dyndns.org
4  *
5  */
6
7 #include "list.h"
8
9 int list_init(t_list *list) {
10
11   list->
12   list->current=&(list->start);
13
14   return L_SUCCESS;
15 }
16
17 int list_add_element(t_list *list,int nr,void *data,int len) {
18
19   if(list->method&C_NUMBER) {
20     while(list->current->next!=NULL) {
21       if(list->current->number==nr) return L_EXISTS;
22       else list->current=list->current->next;
23     }
24     if(list->current->number==nr) return L_EXISTS;
25
26     /* new element */
27     if((list->current->next=(t_list *)malloc(sizeof(t_list)))==NULL) {
28       fprintf(stderr,"[list]