diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-07-07 01:10:27 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-07-07 01:10:27 +0200 |
commit | 487393e9f11e4a06d91df03232914bd8c4b3368e (patch) | |
tree | 137c84629b23a731a3cc114259204b296d7cb684 /src/conf-parser.h | |
parent | c846ff4798c4c48d229587297e6df8b593c60c54 (diff) | |
download | systemd-487393e9f11e4a06d91df03232914bd8c4b3368e.tar.gz |
main: implement manager configuration file
Diffstat (limited to 'src/conf-parser.h')
-rw-r--r-- | src/conf-parser.h | 28 |
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 |