Initial import from http://www.droids-corp.org/hg/libcmdline/rev/db316e4289a1
[libcmdline.git] / src / genconf / conf_parser.h
1 #ifndef _CONF_PARSER_H_
2 #define _CONF_PARSER_H_
3
4 /*
5  * This is the structure defining a token. A token is either a word or
6  * a string surrounded by double quotes.
7  */
8 struct token {
9         TAILQ_ENTRY(token) next;
10         const char *str;
11         unsigned offset; /* offset in line */
12 };
13
14 /* A line is a list of token, plus a flag indicating if the line
15  * starts with space/tab */
16 TAILQ_HEAD(token_list, token);
17 struct line {
18         int start_with_space;
19         struct token_list token_list;
20         unsigned n_token;
21 };
22
23 struct confnode;
24
25 int confnode_check_deps(const struct confnode *n, int verbose);
26 struct confnode *conf_reset_and_read(struct confnode *prev,
27                                      const char *dotconfig_filename);
28
29 int parse_conf_file(const char *filename, struct confnode **pparent,
30                     struct confnode **pcurrent);
31 int confnode_get_value(const struct confnode *n, char *buf, unsigned buflen);
32
33 #endif /* _CONF_PARSER_H_ */