return 0;
} else { while(fgets(line, 256, f) && list->l < list->m) { if(!list->list) { cur = list->list = calloc(sizeof(struct CONFIG_NODE), 1); cur->prev = list->list->prev = NULL; cur->next = NULL; } else { while(cur->next != NULL) cur = cur->next; cur->next = calloc(sizeof(struct CONFIG_NODE), 1); cur->next->prev = cur; cur = cur->next; cur->next = NULL; } for(i = 0; i < 30; i++) { line[i] = tolower(line[i]); } for(i = 0; line[i] != '\n' && line[i] != ' '; i++) { cur->data[i] = line[i]; } cur->data[i] = '\0'; cur->len = i-1; list->l++; } fclose(f); return list->l;
int load_list(struct CONFIG_LIST *list, char *file){     FILE *f = NULL;     int i = 0;     char error[256];     char line[256];     struct CONFIG_NODE *cur;          	 if(!(f = fopen(file, "r")))     {          sprintf(error, "No such file: %s", file);                       log_info(error);          return 0;     }               while(fgets(line, 256, f) && list->l < list->m) {          if(!list->list) {               cur = list->list = calloc(sizeof(struct CONFIG_NODE), 1);               cur->prev = list->list->prev = NULL;               cur->next = NULL;          }          else {               while(cur->next != NULL) cur = cur->next;               cur->next = calloc(sizeof(struct CONFIG_NODE), 1);               cur->next->prev = cur;               cur = cur->next;               cur->next = NULL;          }          for(i = 0; i < 30; i++) {                  line[i] = tolower(line[i]);          }          for(i = 0; line[i] != '\n' && line[i] != ' '; i++) {                   cur->data[i] = line[i];          }          cur->data[i] = '\0';          cur->len = i-1;          list->l++;     }     fclose(f);     return list->l;}