summaryrefslogtreecommitdiff
path: root/src/conf-parser.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-07 01:10:27 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-07 01:10:27 +0200
commit487393e9f11e4a06d91df03232914bd8c4b3368e (patch)
tree137c84629b23a731a3cc114259204b296d7cb684 /src/conf-parser.h
parentc846ff4798c4c48d229587297e6df8b593c60c54 (diff)
main: implement manager configuration file
Diffstat (limited to 'src/conf-parser.h')
-rw-r--r--src/conf-parser.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/conf-parser.h b/src/conf-parser.h
index b3b2915d41..2797076572 100644
--- a/src/conf-parser.h
+++ b/src/conf-parser.h
@@ -53,4 +53,32 @@ int config_parse_path(const char *filename, unsigned line, const char *section,
int config_parse_strv(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
int config_parse_path_strv(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
+#define DEFINE_CONFIG_PARSE_ENUM(function,name,type,msg) \
+ int function( \
+ const char *filename, \
+ unsigned line, \
+ const char *section, \
+ const char *lvalue, \
+ const char *rvalue, \
+ void *data, \
+ void *userdata) { \
+ \
+ type *i = data, x; \
+ \
+ assert(filename); \
+ assert(lvalue); \
+ assert(rvalue); \
+ assert(data); \
+ \
+ if ((x = name##_from_string(rvalue)) < 0) { \
+ log_error("[%s:%u] " msg ": %s", filename, line, rvalue); \
+ return -EBADMSG; \
+ } \
+ \
+ *i = x; \
+ \
+ return 0; \
+ }
+
+
#endif