return NULL;
}
+uint32_t list_length(list_t *a)
+{
+ uint32_t l=0;
+ list_t *i;
+ for (i=a; i; i=i->next) l++;
+ return l;
+}
+
+list_t *list_copy(list_t *a)
+{
+ list_t *r, *i, *b, *l;
+
+ if (!a) return NULL;
+ l=NULL;
+ r=NULL;
+ for (i=a; i; i=i->next) {
+ b=safe_malloc(sizeof(*b),"list_copy");
+ if (l) l->next=b; else r=b;
+ l=b;
+ b->item=i->item;
+ b->next=NULL;
+ }
+ return r;
+}
+
list_t *list_append_list(list_t *a, list_t *b)
{
list_t *i;
+ b=list_copy(b);
if (!a) return b;
for (i=a; i->next; i=i->next);
i->next=b;
}
}
+uint32_t string_to_word(string_t s, struct cloc loc,
+ struct flagstr *f, string_t desc)
+{
+ struct flagstr *j;
+ for (j=f; j->name; j++)
+ if (strcmp(s,j->name)==0)
+ return j->value;
+ cfgfatal(loc,desc,"option \"%s\" not known\n",s);
+ return 0;
+}
+
uint32_t string_list_to_word(list_t *l, struct flagstr *f, string_t desc)
{
list_t *i;
"strings\n");
}
for (j=f; j->name; j++)
- if (strcmp(i->item->data.string,j->name)==0)
- r|=j->value;
+ r|=string_to_word(i->item->data.string,i->item->loc,f,desc);
}
return r;
}