output to stder, added list.* api which is still in work
[my-code/api.git] / list / list.c
index 681db53..221b2fb 100644 (file)
@@ -8,5 +8,21 @@
 
 int list_init(t_list *list) {
 
-  if(list->type==SINGLE) {
-    list->start
+  list->
+  list->current=&(list->start);
+
+  return L_SUCCESS;
+}
+
+int list_add_element(t_list *list,int nr,void *data,int len) {
+
+  if(list->method&C_NUMBER) {
+    while(list->current->next!=NULL) {
+      if(list->current->number==nr) return L_EXISTS;
+      else list->current=list->current->next;
+    }
+    if(list->current->number==nr) return L_EXISTS;
+
+    /* new element */
+    if((list->current->next=(t_list *)malloc(sizeof(t_list)))==NULL) {
+      fprintf(stderr,"[list]