strlist.h 983 Bytes
Newer Older
Bernhard Link's avatar
Bernhard Link committed
1 2 3 4 5 6 7 8 9 10 11 12 13
#ifndef __MIRRORER_STRLIST_H
#define __MIRRORER_STRLIST_H

#ifndef __MIRRORER_ERROR_H
#include "error.h"
#warning "What's hapening here?"
#endif

struct strlist {
	char **values;
	int count,size;
};

14
retvalue strlist_init(struct strlist *strlist);
Bernhard Link's avatar
Bernhard Link committed
15
retvalue strlist_init_n(int startsize,struct strlist *strlist);
16
retvalue strlist_init_singleton(char *value,struct strlist *strlist);
17
void strlist_done(struct strlist *strlist);
Bernhard Link's avatar
Bernhard Link committed
18 19 20

/* add a string, will get property of the strlist and free'd by it */
retvalue strlist_add(struct strlist *strlist,char *element);
21 22
/* include a string at the beginning, otherwise like strlist_add */
retvalue strlist_include(struct strlist *strlist,char *element);
Bernhard Link's avatar
Bernhard Link committed
23

24 25 26 27 28 29
/* print a space seperated list of elements */
retvalue strlist_fprint(FILE *file,const struct strlist *strlist);

/* duplicate with content */
retvalue strlist_dup(struct strlist *dest,const struct strlist *orig);

30
int strlist_in(const struct strlist *strlist,const char *element);
Bernhard Link's avatar
Bernhard Link committed
31 32

#endif